Skip to content

Commit e79291f

Browse files
feat(workflows): improve whitelist workflow with environment variables
- Make whitelist_contract_address optional with environment variable fallback - Remove network determination step and use WHITELIST_NETWORK_NAME variable
1 parent 9ca9e14 commit e79291f

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

.github/workflows/04-add-resource-whitelist.yml

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ on:
2020
required: true
2121
type: string
2222
whitelist_contract_address:
23-
description: 'Whitelist contract address'
24-
required: true
23+
description: 'Whitelist contract address (optional, uses environment variable by default)'
24+
required: false
2525
type: string
2626

2727
jobs:
@@ -44,30 +44,12 @@ jobs:
4444
cd node_modules/whitelist-smart-contract
4545
npm install --save-dev ts-node
4646
47-
- name: Determine network from environment
48-
id: network
49-
run: |
50-
case "${{ inputs.environment }}" in
51-
bellecour-dev|bellecour-prod)
52-
echo "network_name=bellecour" >> $GITHUB_OUTPUT
53-
;;
54-
arbitrum-sepolia-dev|arbitrum-sepolia-prod)
55-
echo "network_name=arbitrum-sepolia" >> $GITHUB_OUTPUT
56-
;;
57-
arbitrum-prod)
58-
echo "network_name=arbitrum" >> $GITHUB_OUTPUT
59-
;;
60-
*)
61-
echo "Error: Unknown environment ${{ inputs.environment }}"
62-
exit 1
63-
;;
64-
esac
65-
6647
- name: Add resource to whitelist
6748
env:
68-
CONTRACT_ADDRESS: ${{ inputs.whitelist_contract_address }}
49+
CONTRACT_ADDRESS: ${{ inputs.whitelist_contract_address || vars.WEB3TELEGRAM_WHITELIST_CONTRACT_ADDRESS }}
6950
PRIVATE_KEY: ${{ secrets.WEB3TELEGRAM_APP_OWNER_PRIVATEKEY }}
51+
WHITELIST_NETWORK_NAME: ${{ vars.WHITELIST_NETWORK_NAME }}
7052
run: |
7153
cd node_modules/whitelist-smart-contract
7254
export ADDRESS_TO_ADD=${{ inputs.app_address }}
73-
npm run addResourceToWhitelist -- --network ${{ steps.network.outputs.network_name }}
55+
npm run addResourceToWhitelist -- --network $WHITELIST_NETWORK_NAME

.github/workflows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ The project uses 3 categories of workflows:
101101
**Whitelist** - Add app to a whitelist already deployed on whitelist-smartcontract repo and transfer ownership to web3telegram wallet
102102

103103
- **Trigger** : `workflow_dispatch`
104-
- **Inputs** : `environment`, `app_address`, `whitelist_contract_address`
104+
- **Inputs** : `environment`, `app_address`, `whitelist_contract_address` (optional)
105105

106106
### `05-configure-ens.yml`
107107

0 commit comments

Comments
 (0)