fix(actions): reject workflow_dispatch for workflows without that trigger#37660
Open
jorgeortiz85 wants to merge 1 commit into
Open
fix(actions): reject workflow_dispatch for workflows without that trigger#37660jorgeortiz85 wants to merge 1 commit into
jorgeortiz85 wants to merge 1 commit into
Conversation
…gger The workflow dispatch API should only create runs for workflows that declare workflow_dispatch. Reject dispatch attempts for workflows without that trigger and return a validation error instead of inserting a run. Regression coverage verifies that a push-only workflow cannot be dispatched via the API and asserts the validation message so the test cannot pass through another 422 path.
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
Fixes #37528
This PR makes the workflow dispatch API reject workflows that do not declare
workflow_dispatch. Previously,POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatchescould create anActionRunfor a workflow that only declared another event such aspush.The service now validates that the target workflow has a
workflow_dispatchtrigger before inserting the run. The API maps that validation failure to422 Unprocessable Entity, matching existing validation failures in this handler.The regression test creates a push-only workflow, dispatches it through the public API, asserts the
workflow_dispatchvalidation message, and verifies that no run was inserted.Testing
go test ./services/actionsTAGS="sqlite sqlite_unlock_notify" make test-integration#TestWorkflowDispatchPublicApiRequiresWorkflowDispatchTriggerTAGS="sqlite sqlite_unlock_notify" make test-integration#TestWorkflowDispatchPublicApiDisclosure
Developed with assistance from OpenAI Codex.