-
Notifications
You must be signed in to change notification settings - Fork 413
131 lines (114 loc) · 4.07 KB
/
Copy pathupdate-registry.yml
File metadata and controls
131 lines (114 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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
permissions: {}
jobs:
update-registry:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- 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..."
pnpm run update-registry \
--version "v1.3.0-eip155" \
--chainId "$CHAIN_ID" \
--verbose
pnpm run update-registry \
--version "v1.3.0-canonical" \
--chainId "$CHAIN_ID" \
--verbose
else
pnpm 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@4e1beaa7521e8b457b572c090b25bd3db56bf1c5
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