Skip to content

Commit f22f732

Browse files
authored
ci: Improve changelog suggestion (#3078)
# Description - Extract non-LLM changes from #3016 - Restrict scope of changelog suggestion to PR with title prefix `^(feat|fix|perf)` - Prevent bot to comment if `/skip-changelog` is present ## Linked Issues - Fixes #3061 - Fixes #3037
1 parent f0b1d1b commit f22f732

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

.github/workflows/pr-check.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,20 @@ jobs:
7272
echo "modified=false" >> $GITHUB_OUTPUT
7373
fi
7474
75-
- name: Comment if changelog is missing
75+
- name: Check if PR type needs changelog
7676
if: steps.changelog-check.outputs.modified == 'false'
77+
id: pr-type-check
78+
env:
79+
PR_TITLE: ${{ github.event.pull_request.title }}
80+
run: |
81+
if [[ "$PR_TITLE" =~ ^(feat|fix|perf)(\(.*\))?:.*$ ]]; then
82+
echo "needs_changelog=true" >> $GITHUB_OUTPUT
83+
else
84+
echo "needs_changelog=false" >> $GITHUB_OUTPUT
85+
fi
86+
87+
- name: Comment if changelog is missing
88+
if: steps.changelog-check.outputs.modified == 'false' && steps.pr-type-check.outputs.needs_changelog == 'true'
7789
uses: actions/github-script@v7
7890
with:
7991
script: |
@@ -91,8 +103,21 @@ jobs:
91103
comment.body.includes('Changelog entry missing')
92104
);
93105
106+
107+
// Check if changelog was already dismissed by an authorized user
108+
const prAuthor = context.payload.pull_request.user.login;
109+
const dismissalComment = comments.find(comment => {
110+
const isAuthorized = comment.user.login === prAuthor ||
111+
['OWNER', 'MEMBER', 'COLLABORATOR'].includes(comment.author_association);
112+
const body = comment.body.toLowerCase();
113+
const isDismissal = body.includes('skip-changelog') ||
114+
body.includes('no changelog') ||
115+
body.includes('/skip-changelog');
116+
return isAuthorized && isDismissal;
117+
});
118+
94119
// Only comment if we haven't already
95-
if (!botComment) {
120+
if (!botComment && !dismissalComment) {
96121
const commentBody = `## ⚠️ Changelog entry missing
97122
98123
No changes detected in \`CHANGELOG.md\`.

0 commit comments

Comments
 (0)