chore(github): ask issue authors without the fix checkbox about a PR (#16271)

* chore(github): ask issue authors without the fix checkbox about a PR

Issues filed through `gh issue create --body` or the API skip the issue
form, so they never carry the "I am working on a fix" checkbox. When the
"Contributing a fix" section is missing from the body, the triage
workflow now comments asking the author whether they plan to open a
pull request. The regression form gets the same checkbox, so its
reports are not asked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(github): cover the issue fix-intent classifier

The classifier moves from the triage workflow into
.github/scripts/issue-fix-intent.sh, with a test that CI runs next to the
other workflow script tests. The workflow checks out the default branch
before the step so the script is available.

A "Contributing a fix" heading without its checkbox now counts as
missing. A hand-written body containing only the heading was classified
as unchecked and got neither an assignment nor the question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zoltan KochanandClaude Opus 5.5 authored and GitHub committed 2026-09-27 16:24:16 +02:00
1 parent b0e193e89e
commit c4ecac2da2
5 files changed
+69 -18

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Reads an issue body on stdin and prints whether the author ticked the issue
# form's "I am working on a fix" checkbox: "checked", "unchecked", or
# "missing" when the body has no such checkbox, e.g. an issue filed with
# `gh issue create --body`. Only the checkbox under the form's own
# "Contributing a fix" heading counts, not the same text in another section.
set -euo pipefail
awk '
{ sub(/\r$/, "") }
/^### / { in_fix = ($0 ~ /^### Contributing a fix[[:space:]]*$/); next }
in_fix && /^- \[[ xX]\] I am working on a fix[[:space:]]*$/ {
seen = 1
if ($0 !~ /^- \[ \]/) checked = 1
}
END { print checked ? "checked" : seen ? "unchecked" : "missing" }
'
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
assert_intent() {
local expected=$1
local body=$2
local actual
actual=$("$script_dir/issue-fix-intent.sh" <<< "$body")
if [ "$actual" != "$expected" ]; then
printf 'expected %s, got %s for body:\n%s\n' "$expected" "$actual" "$body" >&2
exit 1
fi
}
assert_intent checked $'### Describe the Bug\n\nIt breaks.\n\n### Contributing a fix\n\n- [x] I am working on a fix'
assert_intent checked $'### Contributing a fix\r\n\r\n- [X] I am working on a fix\r'
assert_intent unchecked $'### Describe the Bug\n\nIt breaks.\n\n### Contributing a fix\n\n- [ ] I am working on a fix'
assert_intent missing $'### Describe the Bug\n\nIt breaks.\n\nA fix is prepared and will be submitted as a PR shortly.'
assert_intent missing $'### Describe the Bug\n\n- [x] I am working on a fix'
assert_intent missing $'### Contributing a fix\n\nI will send a PR.'
assert_intent missing ''