Skip to content

Commit f9cdaf5

Browse files
authored
prevent breaking o11y with idl changes (#1247)
* prevent breaking o11y with idl changes * test change idl * fix action * fix * change in idl * only ones we need to track * Revert "change in idl" This reverts commit 8378c29. * shouldn't trigger * should detect multiple * fix actin * Revert "should detect multiple" This reverts commit 1a8fd3d. * Revert "shouldn't trigger" This reverts commit c4e8ef2. * fix some comms * add unlabeled * should trigger * Revert "add unlabeled" This reverts commit 79a1d6c. * unlabeled * Revert "should trigger" This reverts commit b47dd70.
1 parent cfd1e49 commit f9cdaf5

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: IDL Compatibility Check
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "chains/solana/contracts/target/idl/base_token_pool.json"
7+
- "chains/solana/contracts/target/idl/ccip_common.json"
8+
- "chains/solana/contracts/target/idl/ccip_offramp.json"
9+
- "chains/solana/contracts/target/idl/ccip_router.json"
10+
- "chains/solana/contracts/target/idl/cctp_token_pool.json"
11+
- "chains/solana/contracts/target/idl/fee_quoter.json"
12+
- "chains/solana/contracts/target/idl/rmn_remote.json"
13+
types: [opened, synchronize, reopened, labeled, unlabeled]
14+
15+
jobs:
16+
check-idl-changes:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
pull-requests: write
20+
contents: read
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Check for bypass label
28+
id: check-bypass
29+
uses: actions/github-script@v6
30+
with:
31+
script: |
32+
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
33+
owner: context.repo.owner,
34+
repo: context.repo.repo,
35+
issue_number: context.issue.number
36+
});
37+
38+
if (labels.some(label => label.name === 'idl-check-confirmed')) {
39+
console.log('IDL check bypass label found');
40+
return true;
41+
}
42+
43+
return false;
44+
45+
- name: List changed IDL files
46+
id: changed-files
47+
run: |
48+
# Only check specific files to reduce noise
49+
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }} HEAD -- \
50+
chains/solana/contracts/target/idl/base_token_pool.json \
51+
chains/solana/contracts/target/idl/ccip_common.json \
52+
chains/solana/contracts/target/idl/ccip_offramp.json \
53+
chains/solana/contracts/target/idl/ccip_router.json \
54+
chains/solana/contracts/target/idl/cctp_token_pool.json \
55+
chains/solana/contracts/target/idl/fee_quoter.json \
56+
chains/solana/contracts/target/idl/rmn_remote.json | tr '\n' ' ')
57+
echo "files=$CHANGED_FILES" >> $GITHUB_OUTPUT
58+
echo "Changed files:"
59+
echo "$CHANGED_FILES"
60+
61+
- name: Comment on PR
62+
if: steps.check-bypass.outputs.result != 'true'
63+
uses: actions/github-script@v6
64+
with:
65+
script: |
66+
const changedFiles = `${{ steps.changed-files.outputs.files }}`.trim().split(' ').filter(Boolean);
67+
68+
if (changedFiles.length === 0) {
69+
console.log('No monitored IDL files changed');
70+
return;
71+
}
72+
73+
const filesList = changedFiles.map(file => `- \`${file}\``).join('\n');
74+
const commentBody = [
75+
'## ⚠️ IDL Compatibility Check Required ⚠️',
76+
'',
77+
'### Changes detected in IDL files:',
78+
filesList,
79+
'',
80+
'⚠️ **IMPORTANT**: Please verify that these changes maintain compatibility with our observability pipeline!',
81+
'',
82+
'#### To bypass this check:',
83+
'- Add the `idl-check-confirmed` label to this PR'
84+
].join('\n');
85+
86+
await github.rest.issues.createComment({
87+
owner: context.repo.owner,
88+
repo: context.repo.repo,
89+
issue_number: context.issue.number,
90+
body: commentBody
91+
});
92+
93+
- name: Fail if no bypass
94+
if: steps.check-bypass.outputs.result != 'true' && steps.changed-files.outputs.files != ''
95+
run: |
96+
echo "::error::IDL changes detected - Please confirm compatibility with observability pipeline"
97+
exit 1

0 commit comments

Comments
 (0)