Skip to content

Commit 43ea772

Browse files
committed
Added healthCheck for new network deployment git action
1 parent 2cc7956 commit 43ea772

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Health Check for New Network Deployment
2+
3+
on:
4+
push:
5+
paths:
6+
- 'networks.json'
7+
pull_request:
8+
paths:
9+
- 'networks.json'
10+
11+
jobs:
12+
check-new-network-health:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Install Bun
19+
uses: oven-sh/setup-bun@v1
20+
with:
21+
bun-version: latest
22+
23+
- name: Install dependencies
24+
run: bun install
25+
26+
- name: Detect Newly Added Networks
27+
id: detect-changes
28+
run: |
29+
echo "Comparing networks.json with the previous commit..."
30+
git fetch origin main --depth=1
31+
OLD_NETWORKS=$(git show origin/main:networks.json | jq 'keys')
32+
NEW_NETWORKS=$(jq 'keys' networks.json)
33+
34+
echo "Old Networks: $OLD_NETWORKS"
35+
echo "New Networks: $NEW_NETWORKS"
36+
37+
ADDED_NETWORKS=$(jq -n --argjson old "$OLD_NETWORKS" --argjson new "$NEW_NETWORKS" '$new - $old')
38+
39+
if [[ "$ADDED_NETWORKS" == "[]" ]]; then
40+
echo "No new networks detected."
41+
echo "CONTINUE=true" >> $GITHUB_ENV
42+
else
43+
echo "New networks detected: $ADDED_NETWORKS"
44+
echo "added_networks=$ADDED_NETWORKS" >> $GITHUB_ENV
45+
fi
46+
47+
- name: Run Health Checks on New Networks
48+
if: env.CONTINUE != 'true'
49+
run: |
50+
echo "Running health check for new networks..."
51+
for network in $(echo $added_networks | jq -r '.[]'); do
52+
echo "🔍 Checking network: $network"
53+
bun run script/deploy/healthCheck.ts $network || exit 1
54+
done

0 commit comments

Comments
 (0)