Repository navigation
fix(ci): add non-blocking reminder for non-closing issue references in PRs - #2351
Conversation
…n PRs Closes #2181 Three issues (#1763, #1867, #1888) were already fully fixed and merged to main but stayed open because the merging PR used "Refs #N" instead of a closing keyword — which looks like a valid reference but does not trigger GitHub's auto-close on merge. Nothing previously caught this. A hard-failing CI gate isn't the right shape here: a non-closing reference ("Refs #N", "Related #N", partial fixes) is often intentional, and text alone can't distinguish that from a mistake. Added a new closing-keyword-check.yml workflow that scans the PR body for issue references using a non-closing phrase with no closing keyword for the same number, and posts (or clears) a single informational PR comment — it never fails the build, it just makes the gap visible for a human to confirm. Uses pull_request_target since the check only reads the trusted event payload's body field (no checkout, no code execution), so it also works on fork PRs, unlike plain pull_request which gets a read-only token there. Also clarified the existing "Related issues" hint in .github/PULL_REQUEST_TEMPLATE.md to spell out that Refs/Related won't auto-close, addressing the PR-template-reminder option directly.
Greptile SummaryThis PR adds a non-blocking workflow that detects non-closing issue references in pull-request descriptions and manages a single informational reminder comment.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the prior foreign-comment mutation issue is fixed by requiring both the unique marker and the Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Event[PR opened, edited, or reopened] --> Scan[Scan PR body]
Scan --> Missing{Non-closing references without matching closing keywords?}
Missing -->|Yes| Existing{Own bot reminder exists?}
Existing -->|Yes| Update[Update reminder]
Existing -->|No| Create[Create reminder]
Missing -->|No| Old{Own bot reminder exists?}
Old -->|Yes| Delete[Delete reminder]
Old -->|No| Done[No action]
Reviews (2): Last reviewed commit: "fix(ci): restrict closing-keyword-check ..." | Re-trigger Greptile |
| repo: context.repo.repo, | ||
| issue_number: prNumber, | ||
| }); | ||
| const existing = comments.find((c) => c.body.includes(marker)); |
There was a problem hiding this comment.
Marker permits foreign comment mutation
When a PR participant posts a comment containing <!-- closing-keyword-check --> and the PR is edited or reopened, the workflow selects that comment without checking its author and then overwrites or deletes it instead of managing only its own reminder. How this was verified: The selected comment is determined only by c.body.includes(marker) and passed directly to the update or delete API.
…d comments Greptile flagged (PR #2351) that matching an existing comment purely by marker text lets a PR participant plant the marker in their own comment and have a later edit/reopen event overwrite or delete it. Restrict the lookup to comments authored by github-actions[bot]. Filed #2352 for the identical pre-existing pattern in codegraph-impact-comment.yml, out of scope for this PR.
Summary
Closes #2181
Three issues (#1763, #1867, #1888) were already fully fixed and merged to
mainbut stayed open because the merging PR used "Refs #N" instead of a closing keyword — which looks like a valid reference but does not trigger GitHub's auto-close on merge. Nothing previously caught this.Fix
A hard-failing CI gate isn't the right shape here: a non-closing reference (
Refs #N,Related #N, a partial fix) is often intentional, and text alone can't distinguish that from a genuine mistake. Instead:.github/workflows/closing-keyword-check.yml: scans the PR body for issue references using a non-closing phrase (Refs #N,Related #N,related to #N,see #N, or a bare(#N)) that have no closing keyword (closes/fixes/resolves+ variants) for that same issue number, and posts (or clears, on later edits) a single informational PR comment. It never fails the build — it only makes the gap visible for a human to confirm.pull_request_targetrather thanpull_request: the check only reads the trusted event payload'sbodyfield — no checkout, no code execution — so this is safe without theworkflow_runsplitcodegraph-impact-comment.ymluses for its riskier (code-executing) case, and it also works correctly on fork PRs, which get a read-only token under plainpull_request..github/PULL_REQUEST_TEMPLATE.mdto spell out thatRefs/Relatedwon't auto-close the issue — addressing the PR-template-reminder option directly, as defense in depth alongside the automated check.Test plan
python3 -c "import yaml; yaml.safe_load(...)"— valid YAML.actionlint .github/workflows/closing-keyword-check.yml— zero findings.