Skip to content

Commit e1e83cf

Browse files
committed
fix(ci): duplicate-fix-guard ignores closing keywords inside code spans and fenced blocks
The guard's first real run — on its own PR — counted the PR body's backticked DISCUSSION of 'Fixes #4551' as a declaration. GitHub's own closing-keyword parser ignores code formatting; a guard stricter than the linker it protects turns prose mentions of other PRs' fix lines into spurious reds. Strip ```fences``` and `spans` before matching. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017gEHJN2NFpS9VMeURvakgD
1 parent b05b537 commit e1e83cf

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/duplicate-fix-guard.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,20 @@ jobs:
4848
'gi',
4949
);
5050
51+
// Strip fenced blocks and inline code spans before matching.
52+
// GitHub's own closing-keyword parser ignores code formatting, and
53+
// this guard must not be stricter than the linker it protects:
54+
// this very PR's first run counted its own DISCUSSION of
55+
// `Fixes #4551` (in backticks, describing the incident) as a
56+
// declaration. Benign there — #4551 is closed — but a prose
57+
// mention of an issue some other open PR really fixes would have
58+
// been a spurious red.
5159
const declaredIssues = (body) => {
60+
const prose = (body || '')
61+
.replace(/```[\s\S]*?```/g, ' ')
62+
.replace(/`[^`\n]*`/g, ' ');
5263
const found = new Set();
53-
for (const [, owner, repo, number] of (body || '').matchAll(pattern)) {
64+
for (const [, owner, repo, number] of prose.matchAll(pattern)) {
5465
// A qualified reference to ANOTHER repo is not ours to judge.
5566
if (owner && `${owner}/${repo}`.toLowerCase() !== thisRepo.toLowerCase()) continue;
5667
found.add(Number(number));

0 commit comments

Comments
 (0)