|
41 | 41 | script: | |
42 | 42 | const highRiskFiles = process.env.high_risk_code; |
43 | 43 | 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({ |
45 | 47 | issue_number: context.issue.number, |
46 | 48 | 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