-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (97 loc) · 3.85 KB
/
update-chains.yml
File metadata and controls
119 lines (97 loc) · 3.85 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
name: Update Blockchain Descriptors
on:
schedule:
# Run weekly on Monday at 00:00 UTC
- cron: '0 0 * * 1'
# Allow manual triggering
workflow_dispatch:
inputs:
specific_chain:
description: 'Specific chain to update (leave empty for all)'
required: false
default: ''
jobs:
update-chains:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Setup metadata directory
run: mkdir -p .papi/metadata
# Define the chains to update
- name: Define chains list
id: chains
run: |
if [ -n "${{ github.event.inputs.specific_chain }}" ]; then
# Use the specific chain if provided in manual trigger
echo "CHAINS=${{ github.event.inputs.specific_chain }}" >> $GITHUB_ENV
else
# Otherwise use the full list of chains
echo "CHAINS=polkadot kusama westend2 paseo polkadot_asset_hub kusama_asset_hub westend_asset_hub rococo_asset_hub polkadot_bridge_hub kusama_bridge_hub westend_bridge_hub rococo_bridge_hub polkadot_collectives pendulum amplitude hydradx basilisk mangata" >> $GITHUB_ENV
fi
# Update all chains in the list
- name: Update chains
run: |
# Process each chain
for chain in $CHAINS; do
# Convert chain name to descriptor key (kebab-case to camelCase, remove non-alphanumeric)
descriptor_key=$(echo $chain | sed -r 's/-([a-z])/\U\1/g' | sed 's/[^a-zA-Z0-9]//g')
# Special case for relay chains to map them to common names
case $chain in
polkadot)
descriptor_key="dot"
;;
kusama)
descriptor_key="ksm"
;;
westend2)
descriptor_key="wnd"
;;
paseo)
descriptor_key="paseo"
;;
esac
echo "Updating chain: $chain with descriptor key: $descriptor_key"
# Run papi add command
npx papi add $descriptor_key -n $chain --skip-codegen
# Check for errors
if [ $? -ne 0 ]; then
echo "Error updating $chain"
# Continue with other chains even if this one fails
continue
fi
echo "Successfully updated $chain"
done
# Run codegen once at the end to include all chains
echo "Running final codegen"
npx papi
# Install the updated descriptors
bun install
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update blockchain descriptors"
title: "Update Blockchain Descriptors"
body: |
# Blockchain Descriptors Update
This automated PR updates the blockchain descriptors for all supported chains in the Polkadot ecosystem.
## Updated Chains
```
${{ env.CHAINS }}
```
## What Changed
- Updated chain metadata
- Updated descriptors with latest type definitions
- Updated dependencies
> This is an automated PR created by the `update-chains` GitHub Action.
branch: chore/update-blockchain-descriptors
base: main
labels: automation, dependencies
delete-branch: true