Skip to content

Commit

Permalink
test-ci
Browse files Browse the repository at this point in the history
Signed-off-by: Logan Nguyen <[email protected]>
  • Loading branch information
quiet-node committed Jan 6, 2025
1 parent 25f541f commit 4493112
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions .github/workflows/erc-registry-indexer.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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."
Expand Down Expand 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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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 }}
Expand Down

0 comments on commit 4493112

Please sign in to comment.