fix: support push event in automation context#1457
Open
tombrov wants to merge 1 commit into
Open
Conversation
Author
|
@wolffiex @km-anthropic I noticed it was pushed before and removed, would love seeing if this could be merged asap for the next release Tested as a standalone in my actions and I can approve it does work |
dovach
approved these changes
Jun 30, 2026
GuyBlassPapaya
approved these changes
Jun 30, 2026
diklamon
approved these changes
Jun 30, 2026
YuriSivPapaya
approved these changes
Jun 30, 2026
AgnePapaya
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
pushto the list of supported GitHub event types so the action can be driven fromon: push:workflows (e.g. post-merge automation that regenerates artifacts after a merge tomain).Before this change,
parseGitHubContext()threwUnsupported event type: pushat startup, blocking any non-PR/non-issue automation use case whereworkflow_dispatchisn't a good fit.What changed
src/github/context.tsPushEventfrom@octokit/webhooks-types."push"toAUTOMATION_EVENT_NAMES(same bucket asworkflow_dispatch,schedule,workflow_run,repository_dispatch).PushEventto theAutomationContext.payloadunion.case "push":in theparseGitHubContext()switch.test/github-context.test.tspush produces an automation contexttest in the automation-events block.isEntityContext/isAutomationContexttype-guard assertions to cover push.isAutomationContext()is derived fromAUTOMATION_EVENT_NAMES, so adding"push"to that tuple makes the type guard recognize it automatically — no other code paths needed changes.Why this approach
prompt:input, which is howworkflow_dispatch/scheduleusers drive the action today.src/create-prompt/index.ts. The secondUnsupported event typethrow lives in tag mode's prompt builder, and tag mode requires an entity context (gated viaisEntityContextindetectMode()andrun.ts). Push events never reach that switch, so the throw stays as-is to preserve the tag-mode invariant.checkWritePermissions,restoreConfigFromBase, andupdateCommentLinkinrun.tsare all wrapped inisEntityContext(context)checks, so they correctly skip on push events.Behavior
With this change, a workflow like:
…now runs Claude in agent mode (no tracking comment, no PR/issue anchor required), matching how
workflow_dispatchalready works.Test plan
bun run typecheckpassesbun test test/github-context.test.tspasses (new push cases + existing automation events)bun testfull suite greenbun run format:checkcleanon: push: branches: [main]reaches Claude and runs the supplied prompt (instead of failing at startup)Fixes #1456