Skip to content

Fix: fall back to default branch when workflow_dispatch trigger missing on PR branch#40441

Closed
Copilot wants to merge 2 commits into
mainfrom
copilot/investigate-fix-skillet-compiler-issue
Closed

Fix: fall back to default branch when workflow_dispatch trigger missing on PR branch#40441
Copilot wants to merge 2 commits into
mainfrom
copilot/investigate-fix-skillet-compiler-issue

Conversation

Copilot AI commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Copilot-generated PR branches (e.g. copilot/add-auto-updates-field) only contain files the agent directly modified — they don't carry compiled .lock.yml workflows like skillet.lock.yml. When the centralized router dispatched skillet.lock.yml on such a branch, GitHub returned HTTP 422 "Workflow does not have 'workflow_dispatch' trigger", crashing the router instead of running skillet.

Changes

  • isMissingWorkflowDispatchTriggerError() — new helper that detects the specific 422 "does not have 'workflow_dispatch' trigger" error, modeled after the existing isDisabledWorkflowDispatchError

  • dispatchWorkflow() fallback — accepts an optional fallbackRef; on trigger-missing error, retries on fallbackRef with no further recursion (passes undefined on the retry to prevent loops)

  • main() wiring — both slash-command and label-route dispatch calls now pass the repository's default branch as fallbackRef

// Before: throws "Failed to dispatch workflow 'skillet.lock.yml' on ref 'refs/heads/copilot/...'"
// After:  logs "Workflow 'skillet.lock.yml' not found on ref '...'; retrying on default branch 'refs/heads/main'."
//         and succeeds

Copilot AI and others added 2 commits June 20, 2026 03:18
…ng on PR branch

When the router dispatches a workflow (e.g. skillet) on a PR's head
branch and that branch doesn't have the compiled .lock.yml, GitHub
returns HTTP 422 "Workflow does not have 'workflow_dispatch' trigger".
The router now detects this error and retries on the default branch.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
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.

2 participants