Skip to content
Closed
Changes from all 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
51 changes: 29 additions & 22 deletions .github/workflows/check_release_notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
permissions:
contents: read
issues: write
pull-requests: read
pull-requests: write
concurrency:
group: release-notes-${{ github.event.pull_request.number }}
cancel-in-progress: true
Expand All @@ -17,7 +17,7 @@ jobs:
permissions:
contents: read
issues: write
pull-requests: read
pull-requests: write
env:
GH_TOKEN: ${{ github.token }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
Expand Down Expand Up @@ -314,29 +314,36 @@ jobs:
github-token: ${{ github.token }}
script: |
const marker = '<!-- DO_NOT_REMOVE: release_notes_check -->';
const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
per_page: 100
});
const existing = comments.find(comment =>
comment.user?.login === 'github-actions[bot]' && comment.body?.includes(marker));

if (existing) {
const comment = await github.rest.issues.updateComment({
// Posting the status comment is best-effort and must never fail the check:
// the release-notes gate is enforced by the previous step's exit code.
try {
const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
per_page: 100
});
const existing = comments.find(comment =>
comment.user?.login === 'github-actions[bot]' && comment.body?.includes(marker));

if (existing) {
const comment = await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body: process.env.COMMENT_BODY
});
return comment.data.id;
}

const comment = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body: process.env.COMMENT_BODY
});
return comment.data.id;
} catch (error) {
core.warning(`Unable to post the release-notes status comment: ${error.message}`);
return '';
}

const comment = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.COMMENT_BODY
});
return comment.data.id;
Loading