Skip to content

Update Registry

Update Registry #32

name: Update Registry
on:
workflow_dispatch:
inputs:
version:
description: 'Safe version with deployment type'
required: true
type: choice
options:
- v1.3.0-canonical
- v1.3.0-eip155
- v1.3.0-both
- v1.4.1
- v1.5.0
chain_id:
description: 'Chain ID to add (e.g., 12345)'
required: true
type: string
workflow_call:
inputs:
version:
description: 'Safe version with deployment type'
required: true
type: string
chain_id:
description: 'Chain ID to add (e.g., 12345)'
required: true
type: string
jobs:
update-registry:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm ci
- name: Validate inputs
env:
VERSION: ${{ inputs.version }}
CHAIN_ID: ${{ inputs.chain_id }}
run: |
# Validate version format (alphanumeric, dots, and hyphens only)
if ! [[ "$VERSION" =~ ^[a-zA-Z0-9.-]+$ ]]; then
echo "ERROR: Invalid version format. Only alphanumeric, dots, and hyphens allowed."
exit 1
fi
# Validate chain ID is numeric only
if ! [[ "$CHAIN_ID" =~ ^[0-9]+$ ]]; then
echo "ERROR: Invalid chain ID format. Must be numeric only."
exit 1
fi
- name: Update registry
env:
VERSION: ${{ inputs.version }}
CHAIN_ID: ${{ inputs.chain_id }}
run: |
if [ "$VERSION" = "v1.3.0-both" ]; then
echo "Running for both v1.3.0 deployment types..."
npm run update-registry -- \
--version "v1.3.0-canonical" \
--chainId "$CHAIN_ID" \
--verbose
npm run update-registry -- \
--version "v1.3.0-eip155" \
--chainId "$CHAIN_ID" \
--verbose
else
npm run update-registry -- \
--version "$VERSION" \
--chainId "$CHAIN_ID" \
--verbose
fi
- name: Check for changes
id: check-changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.check-changes.outputs.has_changes == 'true'
env:
VERSION: ${{ inputs.version }}
CHAIN_ID: ${{ inputs.chain_id }}
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
Add chain ${{ env.CHAIN_ID }} to ${{ env.VERSION }} registry
- Added chain ID ${{ env.CHAIN_ID }} to all contracts in version ${{ env.VERSION }}
title: |
Add chain ${{ env.CHAIN_ID }} to ${{ env.VERSION }} registry
body: |
## Add new chain
> **Automated PR:** This PR was generated by the Update Registry workflow. Ensure that the contracts are deployed on the chain. The RPC will be taken from [DefiLlama's ChainList](https://chainlist.org/).
Please fill the following form:
Provide the Chain ID (Only 1 chain id per PR).
- Chain_ID: ${{ env.CHAIN_ID }}
branch: update-registry-${{ github.run_id }}-${{ env.CHAIN_ID }}
delete-branch: true