-
Notifications
You must be signed in to change notification settings - Fork 84
52 lines (44 loc) · 1.61 KB
/
validate-tokens.yml
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
name: Validate New Token Configurations
on:
pull_request:
paths:
- "registry/mainnet/interchain/squid.tokenlist.json"
jobs:
validate-tokens:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
- name: Install dependencies
run: |
npm install [email protected]
npm install axios
- name: Extract and validate new tokens
run: |
git fetch origin ${{ github.base_ref }}
git show origin/${{ github.base_ref }}:registry/mainnet/interchain/squid.tokenlist.json > base_file.json
cp registry/mainnet/interchain/squid.tokenlist.json current_file.json
node -e "
const fs = require('fs');
const base = JSON.parse(fs.readFileSync('base_file.json', 'utf8'));
const current = JSON.parse(fs.readFileSync('current_file.json', 'utf8'));
const newTokens = Object.entries(current.tokens)
.filter(([id, token]) => !base.tokens[id])
.reduce((obj, [id, token]) => ({ ...obj, [id]: token }), {});
fs.writeFileSync('new_tokens.json', JSON.stringify(newTokens, null, 2));
"
node scripts/validate-token-configs.js
- name: Check validation results
run: |
if [ -f validation_errors.txt ]; then
echo "Validation errors found:"
cat validation_errors.txt
exit 1
else
echo "All new token configurations are valid."
fi