From 4493112c98d78f1dab81727272d6bb7f95e40f9c Mon Sep 17 00:00:00 2001 From: Logan Nguyen Date: Mon, 6 Jan 2025 11:10:35 -0600 Subject: [PATCH] test-ci Signed-off-by: Logan Nguyen --- .github/workflows/erc-registry-indexer.yml | 43 ++++++++++++---------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/erc-registry-indexer.yml b/.github/workflows/erc-registry-indexer.yml index c89585a4..46512f15 100644 --- a/.github/workflows/erc-registry-indexer.yml +++ b/.github/workflows/erc-registry-indexer.yml @@ -1,6 +1,11 @@ name: ERC Registry Indexer on: + push: + branches: + [ + 1128-erc-registry-phase-3-modify-the-workflow-script-to-also-create-a-pr-target-mne-repo, + ] workflow_dispatch: inputs: HEDERA_NETWORK: @@ -15,7 +20,7 @@ on: jobs: index-and-update: - name: Index ERC Contracts on Hedera ${{ github.event.inputs.HEDERA_NETWORK }} and Update Registry + name: Index ERC Contracts on Hedera mainnet and Update Registry runs-on: smart-contracts-linux-large env: INDEXER_PATH: ./tools/erc-repository-indexer/erc-contract-indexer @@ -38,8 +43,8 @@ jobs: - name: Set Environment Variables run: | - echo "HEDERA_NETWORK=${{ github.event.inputs.HEDERA_NETWORK }}" >> ${{ env.INDEXER_PATH }}/.env - echo "MIRROR_NODE_URL=${{ github.event.inputs.MIRROR_NODE_URL }}" >> ${{ env.INDEXER_PATH }}/.env + echo "HEDERA_NETWORK=mainnet" >> ${{ env.INDEXER_PATH }}/.env + echo "MIRROR_NODE_URL=https://mainnet.mirrornode.hedera.com" >> ${{ env.INDEXER_PATH }}/.env echo "STARTING_POINT=${{ github.event.inputs.STARTING_POINT }}" >> ${{ env.INDEXER_PATH }}/.env - name: Install Dependencies @@ -50,8 +55,8 @@ jobs: - name: Backup Existing Registry run: | mkdir -p ${{ env.INDEXER_PATH }}/backup - if [ -d "${{ env.INDEXER_PATH }}/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}" ] && [ "$(ls -A ${{ env.INDEXER_PATH }}/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}/*.json 2>/dev/null)" ]; then - cp ${{ env.INDEXER_PATH }}/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}/*.json ${{ env.INDEXER_PATH }}/backup/ + if [ -d "${{ env.INDEXER_PATH }}/erc-registry/mainnet" ] && [ "$(ls -A ${{ env.INDEXER_PATH }}/erc-registry/mainnet/*.json 2>/dev/null)" ]; then + cp ${{ env.INDEXER_PATH }}/erc-registry/mainnet/*.json ${{ env.INDEXER_PATH }}/backup/ echo "Backup successful." else echo "No JSON files found to back up." @@ -97,16 +102,16 @@ jobs: cd ${{ env.INDEXER_PATH }} # Determine the new amount of ERC-20 records if [ -f backup/erc-20.json ]; then - NEW_ERC20_RECORDS=$(jq -s '.[1] - .[0] | length' backup/erc-20.json erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}/erc-20.json) + NEW_ERC20_RECORDS=$(jq -s '.[1] - .[0] | length' backup/erc-20.json erc-registry/mainnet/erc-20.json) else - NEW_ERC20_RECORDS=$(jq '. | length' erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}/erc-20.json) + NEW_ERC20_RECORDS=$(jq '. | length' erc-registry/mainnet/erc-20.json) fi # Determine the new amount of of ERC-721 records if [ -f backup/erc-721.json ]; then - NEW_ERC721_RECORDS=$(jq -s '.[1] - .[0] | length' backup/erc-721.json erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}/erc-721.json) + NEW_ERC721_RECORDS=$(jq -s '.[1] - .[0] | length' backup/erc-721.json erc-registry/mainnet/erc-721.json) else - NEW_ERC721_RECORDS=$(jq '. | length' erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}/erc-721.json) + NEW_ERC721_RECORDS=$(jq '. | length' erc-registry/mainnet/erc-721.json) fi # Export the results to GitHub environment variables @@ -140,20 +145,20 @@ jobs: uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 with: branch: ERC-Registry-Periodical-Update/${{ github.run_id }} - commit-message: 'chore: update ERC Registry with latest ERC-20 and ERC-721 tokens on Hedera ${{github.event.inputs.HEDERA_NETWORK}}' + commit-message: 'chore: update ERC Registry with latest ERC-20 and ERC-721 tokens on Hedera mainnet' committer: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}> author: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}> token: ${{ secrets.GH_ACCESS_TOKEN }} delete-branch: true signoff: true - title: 'chore: update ERC Registry with latest ERC-20 and ERC-721 tokens on Hedera ${{github.event.inputs.HEDERA_NETWORK}}' + title: 'chore: update ERC Registry with latest ERC-20 and ERC-721 tokens on Hedera mainnet' body: > **Description**: This PR updates the ERC Registry to include the most recent ERC-20 and ERC-721 tokens. **Registry Update Summary**: - - **Hedera Network**: ${{ github.event.inputs.HEDERA_NETWORK }} + - **Hedera Network**: mainnet - **New ERC-20 Records Added**: ${{ env.NEW_ERC20_RECORDS }} - **New ERC-721 Records Added**: ${{ env.NEW_ERC721_RECORDS }} - **Indexing Duration**: ${{ env.INDEXING_DURATION }} @@ -163,8 +168,8 @@ jobs: - name: Backup erc-registry to Temporary Directory run: | - mkdir -p /tmp/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }} - cp -r ${{ env.INDEXER_PATH }}/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}/* /tmp/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }} + mkdir -p /tmp/erc-registry/mainnet + cp -r ${{ env.INDEXER_PATH }}/erc-registry/mainnet/* /tmp/erc-registry/mainnet - name: Checkout hedera-mirror-node-explorer uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -175,27 +180,27 @@ jobs: - name: Restore erc-registry from Temporary Directory run: | - mkdir -p ./erc-registry/${{ github.event.inputs.HEDERA_NETWORK }} - cp -r /tmp/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}/* ./public/${{ github.event.inputs.HEDERA_NETWORK }} + mkdir -p ./erc-registry/mainnet + cp -r /tmp/erc-registry/mainnet/* ./public/mainnet - name: Create Pull Request Target hedera-mirror-node-explorer uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 with: branch: ERC-Registry-Periodical-Update/${{ github.run_id }} - commit-message: 'chore: update ERC Registry with latest ERC-20 and ERC-721 tokens on Hedera ${{github.event.inputs.HEDERA_NETWORK}}' + commit-message: 'chore: update ERC Registry with latest ERC-20 and ERC-721 tokens on Hedera mainnet' committer: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}> author: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}> token: ${{ secrets.GH_ACCESS_TOKEN_MIRROR_NODE_EXPLORER }} delete-branch: true signoff: true - title: 'chore: update ERC Registry with latest ERC-20 and ERC-721 tokens on Hedera ${{github.event.inputs.HEDERA_NETWORK}}' + title: 'chore: update ERC Registry with latest ERC-20 and ERC-721 tokens on Hedera mainnet' body: > **Description**: This PR updates the ERC Registry to include the most recent ERC-20 and ERC-721 tokens. **Registry Update Summary**: - - **Hedera Network**: ${{ github.event.inputs.HEDERA_NETWORK }} + - **Hedera Network**: mainnet - **New ERC-20 Records Added**: ${{ env.NEW_ERC20_RECORDS }} - **New ERC-721 Records Added**: ${{ env.NEW_ERC721_RECORDS }} - **Indexing Duration**: ${{ env.INDEXING_DURATION }}