Skip to content

Commit a2dc2f3

Browse files
committed
ci: stop PR bot over-closing on missing checklist + reopen loop
Two fixes found while auditing the bot against all open PRs: - Only a non-empty Summary plus a demo (for functional changes) are required. Missing Testing/Checklist sections no longer close a PR. The demo is now detected anywhere in the body, not just the Demo section. This fixes a PR that had a YouTube demo and full testing notes but was closed for lacking the checklist section. - Drop the 'reopened' trigger so a maintainer who manually reopens a flagged PR wins, instead of the bot immediately re-closing it. Auto-reopen on a fixed description still works via 'edited'/'synchronize'.
1 parent a81e5c9 commit a2dc2f3

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

.github/workflows/13-check-pr-contribution.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ name: "13 - check PR contribution"
1010
# It never checks out or runs the PR's code, so this is safe.
1111

1212
on:
13+
# No 'reopened': a maintainer who manually reopens a flagged PR should win,
14+
# otherwise the reopen event would immediately re-close it. Auto-reopen on a
15+
# fixed description still works through 'edited' and 'synchronize'.
1316
pull_request_target:
14-
types: [opened, edited, synchronize, reopened, ready_for_review]
17+
types: [opened, edited, synchronize, ready_for_review]
1518
workflow_dispatch:
1619
inputs:
1720
pr_number:
@@ -116,27 +119,24 @@ jobs:
116119
117120
const reasons = [];
118121
119-
// 1) Template is present and filled.
120-
const headers = ['Summary', 'Testing', 'Demo', 'Checklist'];
121-
const lower = body.toLowerCase();
122-
const missing = headers.filter((h) => !lower.includes('## ' + h.toLowerCase()));
122+
// 1) The PR is described. We only require a non-empty Summary, not the
123+
// full template. Missing Testing/Checklist sections do not close a PR;
124+
// a thorough PR with a demo should never be closed over a checklist.
123125
if (!body.trim()) {
124126
reasons.push('The pull request description is empty. Please fill in the PR template.');
125-
} else if (missing.length) {
126-
reasons.push('The description is missing required sections (' + missing.join(', ') + '). Please use the PR template without removing its sections.');
127127
} else if (!section('Summary')) {
128-
reasons.push('The **Summary** section is empty. Describe what changed and why.');
128+
reasons.push('The **Summary** section is missing or empty. Describe what changed and why using the PR template.');
129129
}
130130
131-
// 2) Demo is present for functional changes.
131+
// 2) Demo is present for functional changes. Scan the whole body, not
132+
// just the Demo section, so a screenshot or video placed anywhere counts.
132133
const files = await github.paginate(github.rest.pulls.listFiles, {
133134
owner, repo, pull_number: number, per_page: 100,
134135
});
135136
const functional = files.some((f) => !EXEMPT.some((r) => r.test(f.filename)));
136-
const demo = section('Demo') || '';
137-
const hasMedia = MEDIA.some((r) => r.test(demo));
137+
const hasMedia = MEDIA.some((r) => r.test(body));
138138
if (functional && !hasMedia) {
139-
reasons.push('This PR changes functional code (SDK, API, or frontend) but the **Demo** section has no screenshot or video. A short demo recording is required. Only test-only, docs-only, or chore changes may mark Demo as N/A.');
139+
reasons.push('This PR changes functional code (SDK, API, or frontend) but includes no demo. Add a screenshot or short video of the change. Only test-only, docs-only, or chore changes may skip it.');
140140
}
141141
142142
async function upsertComment(text) {

0 commit comments

Comments
 (0)