Skip to content

claude.yml: let workflow_dispatch/schedule through the job if: gate - #246

Merged
d-morrison merged 2 commits into
mainfrom
claude/github-issue-245-509t27
Jul 9, 2026
Merged

d-morrison merged 2 commits into
mainfrom
claude/github-issue-245-509t27

Conversation

@dem-extra1

Copy link
Copy Markdown
Collaborator

Closes #245.

Problem

claude.yml's reusable job's if: only matched four reactive,
mention-triggered events (issue_comment, pull_request_review_comment,
pull_request_review, issues). A caller wired up to invoke Claude on
workflow_dispatch or schedule (e.g. a periodic "run this skill weekly"
automation with no human comment to react to) got a workflow that appeared
correctly configured but silently skipped the claude job on every run —
none of the four || branches ever evaluate true for those event types.

Fix (option 1 from the issue)

  • Added a workflow_dispatch/schedule branch to the job if:, gated on
    event name alone — both events already require repo write access to
    trigger, so they're trusted by construction and need no
    comment-body/author-association check.
  • Documented the new trust model in the header comment and inline next to
    the if:.
  • Since unattended runs have no triggering comment/issue/review, the
    hard-coded prompt text ("You were triggered by an @claude mention…") was
    wrong for them — added a conditional intro (mirroring the existing
    format() ternary pattern already used in
    run-claude-review-attempt/action.yml) that instead points the agent at
    prompt-addendum for the actual task, and a note that these runs get no
    branch/draft-PR/reply-comment scaffolding (there's no triggering issue or
    PR to attach one to).
  • Updated examples/claude.yml with a commented schedule/workflow_dispatch
    trigger block, the matching caller-side if: widening, and a
    prompt-addendum example for stating the actual task on an unattended run.
  • Updated website/reference/claude.qmd to document unattended-run support.
  • Added a changelog fragment under changelog.d/.

Test plan

  • python3 -c "import yaml; yaml.safe_load(open('.github/workflows/claude.yml'))" and same for examples/claude.yml — both parse.
  • Confirmed the &&/|| ternary + format() pattern used in the new prompt line matches existing precedent in .github/actions/run-claude-review-attempt/action.yml.
  • CI (_selftest.yml and the dogfood claude-review.yml) — will watch and iterate on this PR.

Generated by Claude Code

The job if: only matched the four reactive, mention-triggered events, so a
caller wired up for unattended/periodic invocation (e.g. a scheduled skill
run) got a workflow that looked correctly configured but silently skipped
the claude job on every run. Both events are trusted by construction
(triggering them requires repo write access), so they now pass unconditionally
alongside the existing @claude-mention/author_association checks.

Also updates the agent's own prompt, examples/claude.yml, and the reference
docs to explain that these unattended runs get no triggering issue/PR (no
branch, draft PR, or reply comment), so the actual task belongs in
prompt-addendum and any output must be persisted with tools claude-args
grants.

Fixes #245.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019bKbFr7bpgQUnf6iFBm2mC
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Comment thread website/reference/claude.qmd Resolved
Comment thread .github/workflows/claude.yml Resolved
Comment thread .github/workflows/claude.yml Resolved
@claude

claude Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Code review

Reviewed the diff (.github/workflows/claude.yml, examples/claude.yml, website/reference/claude.qmd, changelog.d/claude-unattended-triggers.fixed.md) for CLAUDE.md compliance, bugs, and security. The if: gate widening itself and the format()-ternary prompt logic are logically sound (verified boolean precedence, all four event-type combinations, and downstream step gating for PR/issue-only steps — those correctly stay skipped on workflow_dispatch/schedule). No hallucinated symbols, inputs, or APIs — prompt-addendum and claude-args are real, existing inputs.

Three findings posted as inline comments, most severe first:

  1. .github/workflows/claude.yml:603-608 (bug) — the new prompt text claims "no post-step posts a reply comment" for unattended runs, but the Acknowledge @claude mention and Post Claude's response if no code was committed steps aren't gated to exclude workflow_dispatch/schedule, so they run and fail (visibly, for the first one) on every unattended run.
  2. website/reference/claude.qmd:11-14 — "the caller's on: just needs to include one of those triggers" is incomplete; examples/claude.yml's own new comment (same PR) says the caller-side if: gate also needs manual widening.
  3. .github/workflows/claude.yml:199-207 — minor precision issue: "both require repo write access to trigger" is accurate for workflow_dispatch but not schedule (no trigger-time actor/permission check exists for cron; the real basis is default-branch provenance). Repeated across 4 files.

None of these are security problems — the "trusted by construction" security conclusion itself holds up under scrutiny (verified against GitHub's documented workflow_dispatch/schedule trigger model), and the functional gap in finding 1 fails soft (no job failure). But finding 1 is a real, deterministic behavioral bug worth fixing before or shortly after merge.

Verdict

Needs more work — the fixable bug in finding 1 (spurious failing/warning post-steps on every unattended run, contradicting the PR's own documentation) should be addressed before merge; findings 2-3 are doc-accuracy fixes that can ride along.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Claude finished review — View run


Review complete. Summary of what I posted to PR #246:

3 inline comments on d-morrison/gha#246:

  1. .github/workflows/claude.yml:603-608 — the new prompt text's claim "no post-step posts a reply comment" is false: two pre-existing post-steps (Acknowledge @claude mention, Post Claude's response if no code was committed) aren't gated to exclude workflow_dispatch/schedule, so they run and fail (one visibly) on every unattended run. This was independently confirmed by two review agents and my own trace through the code.
  2. website/reference/claude.qmd:11-14 — claims the caller's on: alone is sufficient, contradicted by examples/claude.yml's own new comment (same PR) saying the caller-side if: gate also needs widening.
  3. .github/workflows/claude.yml:199-207 — the "both require repo write access to trigger" justification is accurate for workflow_dispatch but not schedule (cron has no trigger-time actor/permission check); repeated across 4 files.

Plus a top-level summary comment with the verdict.

Verdict

Needs more work — finding 1 is a real behavioral bug that should be fixed before or shortly after merge; findings 2-3 are doc-accuracy fixes. The core if: gate logic and security reasoning are otherwise sound.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

💰 Cost: $6.9529 (review) — run

…ccess wording

Address review findings on #246:
- Acknowledge @claude mention and Post Claude's response if no code was
  committed now require a triggering issue/PR number, so they're actually
  skipped on workflow_dispatch/schedule runs instead of running and failing
  (the first visibly) as the PR's own docs claimed they wouldn't.
- "Both require repo write access to trigger" overstated schedule's
  mechanism: cron has no triggering actor or permission check at fire time,
  only default-branch provenance. Reworded across claude.yml, examples/
  claude.yml, website/reference/claude.qmd, and the changelog fragment.
- website/reference/claude.qmd's "the caller's on: just needs to include one
  of those triggers" was incomplete (examples/claude.yml's own new comment
  says the caller-side if: gate needs widening too) and used a non-ASCII em
  dash that failed the check-chars CI job; reworded to state both steps and
  drop the em dash.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019bKbFr7bpgQUnf6iFBm2mC

Copy link
Copy Markdown
Collaborator Author

Addressed all three review findings in 3c5cff8:

  1. Bug (post-steps not gated for unattended runs) — Addressed. Acknowledge @claude mention and Post Claude's response if no code was committed now require (github.event.issue.number || github.event.pull_request.number) in their if:, matching the pattern already used elsewhere in this file (e.g. ENTITY_NUMBER's own fallback chain), so they're skipped rather than run-and-fail on workflow_dispatch/schedule.
  2. website/reference/claude.qmd incomplete claim — Addressed. Reworded to state both that the caller needs the trigger in on: and needs to widen the caller-side if: gate, pointing at examples/claude.yml's commented example.
  3. "repo write access" imprecise for schedule — Addressed across all 4 locations (claude.yml, examples/claude.yml, claude.qmd, changelog fragment): now distinguishes workflow_dispatch (dispatching actor needs write access) from schedule (no triggering actor at all — trusted via default-branch provenance instead).

Also fixed the check-chars CI failure (an em dash in claude.qmd from my own initial edit) while rewording finding 2's paragraph.


Generated by Claude Code

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

👀 Picked up by workflow run #29041058093. Setup runs first; Claude itself responds after that.

@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.

2026-07-09 18:44 UTC

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Claude finished review — View run


No stray file was created (the earlier redirect was blocked before anything was written), so nothing to clean up.

Code review

This is a follow-up review of PR #246 after commit 3c5cff8. The prior review round (posted at the comment linked here) found three issues and returned a Needs more work verdict. I verified each against the current diff rather than trusting the author's reply at face value:

  1. Bug — unattended-run post-steps not gated (.github/workflows/claude.yml:294, :763): Fixed. Both Acknowledge @claude mention and Post Claude's response if no code was committed now require (github.event.issue.number || github.event.pull_request.number) in their if:, which is empty/falsy for workflow_dispatch/schedule and non-empty for all four reactive events — confirmed this matches the existing idiom already used elsewhere in the same file (e.g. the concurrency group: at line 220), not a novel/untested pattern.
  2. website/reference/claude.qmd incomplete claim: Fixed. It now states both that the caller's on: needs the trigger and that the caller-side if: gate needs widening, pointing at the commented example in examples/claude.yml.
  3. Imprecise "repo write access" wording for schedule: Fixed consistently across all four locations (claude.yml, examples/claude.yml, claude.qmd, and the changelog fragment) — each now correctly distinguishes workflow_dispatch (dispatching actor needs write access) from schedule (no triggering actor; trusted via default-branch provenance).

No new issues introduced by this fix commit. The check-chars em-dash fix the author mentioned is also reflected (no non-ASCII em dashes remain in the touched claude.qmd text).

Verdict

Ready for merge — all three findings from the prior review round are verified fixed, and no new issues were found in the fix commit.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

💰 Cost: $0.6222 (review) — run

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Investigated why this session was triggered. The comment that fired this run (dem-extra1's "Addressed all three review findings in 3c5cff8", posted 2026-07-09T18:32:53Z) isn't an actual request — it matched the workflow's contains(comment.body, '@claude') gate only because it quotes the step name `Acknowledge @claude mention` in prose. There's no new ask in it.

I checked the rest of the state to be safe:

No code change needed here. One thing worth flagging separately (not fixing now, since it's unrelated to #245's actual fix): the job if: gate's contains(body, '@claude') check will re-trigger on any future status comment that merely quotes a step name or prior mention containing that string, same as happened here — worth a follow-up issue if that turns out to be a recurring nuisance rather than a one-off.

— posted by @claude post-step from workflow run

💰 Cost: $0.7152426000000002

@d-morrison
d-morrison merged commit 58473fd into main Jul 9, 2026
21 checks passed
@d-morrison
d-morrison deleted the claude/github-issue-245-509t27 branch July 9, 2026 18:43
d-morrison pushed a commit that referenced this pull request Jul 9, 2026
…#245/#246 (#247)

Widening claude.yml's job if: to admit workflow_dispatch/schedule (#245)
left two post-steps still ungated for those events, caught only in review
(#246) rather than the author's own self-check. Record the general pattern
so future if:-gate widening on this file (or claude-code-review.yml) checks
downstream steps' event-shaped context up front.


Claude-Session: https://claude.ai/code/session_019bKbFr7bpgQUnf6iFBm2mC

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claude.yml reusable job's if: gate never matches workflow_dispatch/schedule — silently skips on unattended triggers

3 participants