Refactor GitHub Actions workflow to remove Solana wallet data fetchin… #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update walletsData.json | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| jobs: | |
| update-wallets-data: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch new EVM walletsData.json | |
| id: fetch_wallets_data | |
| run: | | |
| echo "Fetching new EVM walletsData.json..." | |
| curl --fail -s -o new_walletsData.json https://explorer-api.walletconnect.com/v3/wallets?projectId=4b988e37fe730153d49f1ecb64fbbaa7 | |
| if [ ! -s new_walletsData.json ]; then | |
| echo "❌ Downloaded EVM walletsData.json is empty!" | |
| exit 1 | |
| fi | |
| if ! jq empty new_walletsData.json > /dev/null 2>&1; then | |
| echo "❌ Downloaded EVM walletsData.json is not valid JSON!" | |
| cat new_walletsData.json | |
| exit 1 | |
| fi | |
| - name: Compare with existing EVM walletsData.json | |
| id: compare_wallets_data | |
| run: | | |
| echo "Comparing new EVM walletsData.json with existing one..." | |
| jq --sort-keys . apps/app/public/walletsData.json > old_normalized.json | |
| jq --sort-keys . new_walletsData.json > new_normalized.json | |
| if diff -q old_normalized.json new_normalized.json > /dev/null; then | |
| echo "No changes detected in EVM walletsData.json." | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changes detected in EVM walletsData.json." | |
| jq --sort-keys . new_walletsData.json > apps/app/public/walletsData.json | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| # Clean up temporary files | |
| rm -f old_normalized.json new_normalized.json new_walletsData.json | |
| - name: Create Pull Request | |
| if: steps.compare_wallets_data.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| commit-message: "chore: update walletsData.json" | |
| title: "chore: update walletsData.json" | |
| body: | | |
| This PR updates wallet data with the latest information from WalletConnect API. | |
| - EVM wallets: ${{ steps.compare_wallets_data.outputs.changed == 'true' && 'Updated ✅' || 'No changes' }} | |
| branch: update-wallets-data | |
| base: dev | |
| delete-branch: true |