Skip to content

Fix docs-review noop on issue_comment triggers (fork and non-fork PRs) - #250

Merged
theletterf merged 2 commits into
mainfrom
fix/docs-review-pr-number-workflow-call
Jul 27, 2026
Merged

Fix docs-review noop on issue_comment triggers (fork and non-fork PRs)#250
theletterf merged 2 commits into
mainfrom
fix/docs-review-pr-number-workflow-call

Conversation

@theletterf

Copy link
Copy Markdown
Member

Problem

When gh-aw-docs-review.lock.yml is triggered via the AI PR menu (issue_comment edit event), the agent noops with "pull-request-number is false". This affects all PRs (fork and non-fork).

Root cause: the gh-aw framework exposes pull-request-number to the agent as github.event.pull_request.number, which is always null for issue_comment events — the PR number lives at github.event.issue.number instead. The pre-step jq extraction is fine (eligible_count=1 in logs for fork runs), but the agent checks pull-request-number and noops before reading the pre-fetched data. Whether the agent self-recovers via github-issue_read is non-deterministic (it did for one non-fork run, did not for the fork run).

Fix

Two changes to gh-aw-docs-review.md:

  1. Shell (pre-step): The "Run Vale on changed markdown" step now injects PR_NUMBER_FROM_CONTEXT via env: using the expression ${{ github.event.pull_request.number || github.event.issue.number }} (expressions propagate the original event context even through workflow_call). It writes a trigger-context.json file with {"pr_number": N, "is_pr_context": true/false}.

  2. Prompt: Replaces the ambiguous "Confirm that the triggering item is a pull request or PR comment context" instruction with an explicit directive to read trigger-context.json first and use is_pr_context as the gate — explicitly warning that pull-request-number is unreliable for issue_comment triggers.

Test plan

  • Trigger the AI PR menu docs review from a fork PR — confirm the agent reads trigger-context.json, sees is_pr_context: true, and proceeds with the review instead of nooping
  • Trigger from a non-fork PR — same expectation
  • Trigger on an actual issue (not a PR) — confirm is_pr_context: false causes a correct noop

🤖 Generated with Claude Code

When the lock file is called via uses: from docs-pr-ai-menu, the
$GITHUB_EVENT_PATH on disk contains the workflow_call payload (just inputs),
not the original issue_comment event. The jq that extracts the PR number
from GITHUB_EVENT_PATH returns empty, causing the pre-step to write
"not a pull request context" and the agent to noop.

GitHub Actions expressions (${{ github.event.* }}) DO propagate the
original event context to called workflows, so injecting the PR number via
env: before the jq fallback fixes the extraction without requiring a new input.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@theletterf
theletterf requested a review from a team as a code owner July 27, 2026 08:25
@theletterf
theletterf requested a review from reakaleek July 27, 2026 08:25
@theletterf theletterf self-assigned this Jul 27, 2026
@theletterf theletterf added the fix label Jul 27, 2026
@theletterf
theletterf merged commit b31130f into main Jul 27, 2026
5 checks passed
@theletterf
theletterf deleted the fix/docs-review-pr-number-workflow-call branch July 27, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant