Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions .github/workflows/changes-in-high-risk-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,37 @@ jobs:
script: |
const highRiskFiles = process.env.high_risk_code;
const fileList = highRiskFiles.split(',').map(file => `- [ ] ${file}`).join('\n');
github.rest.issues.createComment({

const marker = '馃毃 Detected changes in high risk code 馃毃';
const body = `### ${marker} \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}`;

// Get existing comments (paginate so older comments are not missed)
const comments = await github.paginate(github.rest.issues.listComments, {
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
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}`
})
per_page: 100
});

const existingComment = comments.find(comment =>
comment.body?.includes(marker)
);

// Update the existing warning so the file list stays current, else create once
if (existingComment) {
if (existingComment.body !== body) {
await github.rest.issues.updateComment({
comment_id: existingComment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body
});
}
Comment thread
sentry-junior[bot] marked this conversation as resolved.
} else {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body
});
}