Skip to content

Commit

Permalink
chore: added workflow script for ERC registry project
Browse files Browse the repository at this point in the history
Signed-off-by: Logan Nguyen <[email protected]>
  • Loading branch information
quiet-node committed Dec 12, 2024
1 parent bf93ef2 commit 268849d
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/erc-registry-indexer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: ERC Registry Indexer

on:
workflow_dispatch:
inputs:
HEDERA_NETWORK:
description: 'Target Hedera network (e.g., previewnet, testnet, mainnet).'
required: true
MIRROR_NODE_URL:
description: 'Mirror node base URL (e.g., https://testnet.mirrornode.hedera.com).'
required: true
STARTING_POINT:
description: 'Starting point for indexing (e.g., a contractId, a contract address, ect.). Leave empty to start from the beginning.'
required: false

jobs:
index-and-update:
name: Index ERC Contracts and Update Registry
runs-on: smart-contracts-linux-large
env:
INDEXER_PATH: ./tools/erc-repository-indexer/erc-contract-indexer

steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

- name: Use Node.js [20]
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20

- 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 "STARTING_POINT=${{ github.event.inputs.STARTING_POINT }}" >> ${{ env.INDEXER_PATH }}/.env
- name: Install Dependencies
run: |
cd ${{env.INDEXER_PATH}}
npm install
- name: Start ERC Registry Indexer
run: |
cd ${{env.INDEXER_PATH}}
npm start
- name: Import GPG Key
id: gpg_importer
uses: step-security/ghaction-import-gpg@6c8fe4d0126a59d57c21f87c9ae5dd3451fa3cca # v6.1.0
with:
git_commit_gpgsign: true
git_tag_gpgsign: true
git_user_signingkey: true
gpg_private_key: ${{ secrets.GPG_KEY_CONTENTS }}
passphrase: ${{ secrets.GPG_KEY_PASSPHRASE }}

- name: Get Current Date
id: current_date
run: echo "CURRENT_DATE=$(date -u +"%m-%d-%Y")" >> $GITHUB_ENV

- name: Create Pull Request
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 tokens on ${{github.event.inputs.HEDERA_NETWORK}}'
committer: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}>
author: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}>
delete-branch: true
signoff: true
title: 'chore: update ERC Registry with latest tokens on ${{github.event.inputs.HEDERA_NETWORK}}'
body: >
**Description**:
This PR provides an update for the ERC Registry, including the latest ERC-20 and ERC-721 tokens indexed from Hedera ${{ github.event.inputs.HEDERA_NETWORK }} as of ${{ env.CURRENT_DATE }}.
Fixes #
labels: 'internal'
token: ${{ secrets.GH_ACCESS_TOKEN }}
assignees: 'swirlds-automation'
2 changes: 2 additions & 0 deletions local.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ PRIVATE_KEYS=
RETRY_DELAY=3000 # ms
MAX_RETRY=5

HEDERA_NETWORK=mainnet
MIRROR_NODE_URL=https://mainnet.mirrornode.hedera.com

0 comments on commit 268849d

Please sign in to comment.