Skip to content

Commit 18e6fd7

Browse files
authored
ci: comment high risk only once (#2414)
* fix ci * demo * update * Update native_app_start_integration.dart
1 parent bd75526 commit 18e6fd7

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

.github/workflows/changes-in-high-risk-code.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,25 @@ jobs:
4141
script: |
4242
const highRiskFiles = process.env.high_risk_code;
4343
const fileList = highRiskFiles.split(',').map(file => `- [ ] ${file}`).join('\n');
44-
github.rest.issues.createComment({
44+
45+
// Get existing comments
46+
const comments = await github.rest.issues.listComments({
4547
issue_number: context.issue.number,
4648
owner: context.repo.owner,
47-
repo: context.repo.repo,
48-
body: `### 🚨 Detected changes in high risk code 🚨 \n High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:\n ${fileList}`
49-
})
49+
repo: context.repo.repo
50+
});
51+
52+
// Check if we already have a high risk code comment
53+
const hasExistingComment = comments.data.some(comment =>
54+
comment.body.includes('🚨 Detected changes in high risk code 🚨')
55+
);
56+
57+
// Only create comment if we don't already have one
58+
if (!hasExistingComment) {
59+
await github.rest.issues.createComment({
60+
issue_number: context.issue.number,
61+
owner: context.repo.owner,
62+
repo: context.repo.repo,
63+
body: `### 🚨 Detected changes in high risk code 🚨 \n High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:\n ${fileList}`
64+
});
65+
}

0 commit comments

Comments
 (0)