-
Notifications
You must be signed in to change notification settings - Fork 78
68 lines (61 loc) · 2.29 KB
/
addressChecks.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Address Checks
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
jobs:
update-data:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Install dependencies
run: |
if [ -e yarn.lock ]; then
yarn install
yarn global add ts-node
elif [ -e package-lock.json ]; then
npm ci
npm install -g ts-node
else
npm install
npm install -g ts-node
fi
npm run build
- name: Run checks and update data
env:
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
run: |
ts-node scripts/runAddressChecks.ts
- name: Check if all checks passed
id: check_all_passed
run: |
ALL_CHECKS_PASSED=$(jq -r '.addressChecks.allChecksPassed' scripts/fetchedAddressData.json)
echo "All checks passed: $ALL_CHECKS_PASSED"
echo "all_checks_passed=$ALL_CHECKS_PASSED" >> $GITHUB_ENV
if [ "$ALL_CHECKS_PASSED" != "true" ]; then
echo "Generating issue content..."
echo "Automatic Address Checks have failed. The following contracts have changed:" > issue_body.md
jq -r '.addressChecks.failedChecks[]' scripts/fetchedAddressData.json | while read CHECK; do
echo "- $CHECK" >> issue_body.md
done
echo "The addresses shown above should be the updated, correct addresses. Please review and change the values in \`src/ethereum/constants.ts\`." >> issue_body.md
echo "" >> issue_body.md
echo "Updated fetchedAddressData.json content:" >> issue_body.md
cat scripts/fetchedAddressData.json >> issue_body.md
fi
- name: Create an issue if checks failed
if: env.all_checks_passed != 'true'
uses: peter-evans/create-issue-from-file@v4
with:
token: ${{ secrets.RG_ISSUES_TOKEN }}
title: 'Address Checks Failed'
content-filepath: 'issue_body.md'
labels: 'address-checks, alert'
assignees: 'rossgalloway'