chore: always resolve the command comment (#32482)

This commit is contained in:
andig 2026-08-03 14:08:25 +02:00 • committed by GitHub
parent c3f3384bfc
commit 2db475f6e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 16 deletions

View file

@ -65,7 +65,7 @@ jobs:
actions: read
# analyze mode gets read + comment + api tools only; triage/fix
# additionally get Edit/Write + git/PR tools to actually make and push a
# fix (fix mode also gets gh api to resolve its invoking comment). Task
# fix (analyze/fix need gh api to read their invoking comment). Task
# is blocked in all modes so the agent can't offload work to a
# background sub-agent and exit before it returns. All modes get read-only
# git log and gh pr view/diff to trace a regression to its pull request.
@ -176,17 +176,24 @@ jobs:
cannot determine the correct change with confidence, do NOT open a
PR — explain why in your step 2 comment instead.
If MODE is "analyze", do NOT label, edit, or open PRs. Instead, ONLY after
you posted a CONCLUSIVE answer in step 2 (not a request for more info),
resolve the invoking comment by minimizing it as resolved:
gh api graphql -f query='mutation($id:ID!){minimizeComment(input:{classifier:RESOLVED,subjectId:$id}){minimizedComment{isMinimized}}}' -f id='${{ inputs.comment_node_id }}'
If you instead asked for more information, do NOT minimize it.
If MODE is "analyze", do NOT label, edit, or open PRs.
If MODE is "fix", do NOT label or edit issue metadata. Instead, ONLY
after you successfully opened a fix PR in step 5, resolve the invoking
comment the same way:
gh api graphql -f query='mutation($id:ID!){minimizeComment(input:{classifier:RESOLVED,subjectId:$id}){minimizedComment{isMinimized}}}' -f id='${{ inputs.comment_node_id }}'
If you did not open a PR, do NOT minimize it.
If MODE is "fix", do NOT label or edit issue metadata.
Do not minimize or otherwise touch the invoking comment, the workflow
resolves it once you are done.
Follow the repository's AGENTS.md conventions for commit/PR style. Do not
force-push and do not touch unrelated files.
# the agent posts its result as a comment, so the command has been answered
# whatever that result was. only a failed run leaves it open, there is no
# answer then
- name: Resolve invoking comment
if: inputs.comment_node_id != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ID: ${{ inputs.comment_node_id }}
run: |
gh api graphql -f id="$NODE_ID" -f query='
mutation($id:ID!){minimizeComment(input:{subjectId:$id,classifier:RESOLVED}){minimizedComment{isMinimized}}}'

View file

@ -6,8 +6,8 @@ on:
# Triggered by a `/analyze` comment on any issue or PR conversation. Delegates to
# the shared issue agent in analyze mode, which investigates, posts one answer
# comment, then minimizes the calling `/analyze` comment as RESOLVED — but only
# when it actually answered.
# comment, then minimizes the calling `/analyze` comment as RESOLVED, whatever
# the answer says.
jobs:
analyze:
name: Analyze on demand

View file

@ -198,11 +198,12 @@ jobs:
});
- name: Resolve command comment
if: steps.create.outputs.url
if: always()
uses: actions/github-script@v8
with:
script: |
// collapse the /backport comment as resolved now that the pull request exists
// collapse the /backport comment as resolved, the result was reported
// back as a comment either way
await github.graphql(
`mutation($id:ID!){minimizeComment(input:{subjectId:$id,classifier:RESOLVED}){minimizedComment{isMinimized}}}`,
{ id: context.payload.comment.node_id }

View file

@ -7,7 +7,7 @@ on:
# Triggered by a `/fix` comment on any issue or PR conversation, maintainers only.
# Delegates to the shared issue agent in fix mode, which investigates, pushes a
# fix branch, opens a PR, comments with the result, then minimizes the calling
# `/fix` comment as RESOLVED — but only when it actually opened a PR.
# `/fix` comment as RESOLVED, whether or not a PR was opened.
jobs:
fix:
name: Fix on demand