Skip to content

fix(actions): reject workflow_dispatch for workflows without that trigger#37660

Open
jorgeortiz85 wants to merge 1 commit into
go-gitea:mainfrom
jorgeortiz85:fix/workflow-dispatch-admission
Open

fix(actions): reject workflow_dispatch for workflows without that trigger#37660
jorgeortiz85 wants to merge 1 commit into
go-gitea:mainfrom
jorgeortiz85:fix/workflow-dispatch-admission

Conversation

@jorgeortiz85
Copy link
Copy Markdown

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}/dispatches could create an ActionRun for a workflow that only declared another event such as push.

The service now validates that the target workflow has a workflow_dispatch trigger before inserting the run. The API maps that validation failure to 422 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_dispatch validation message, and verifies that no run was inserted.

Testing

  • go test ./services/actions
  • TAGS="sqlite sqlite_unlock_notify" make test-integration#TestWorkflowDispatchPublicApiRequiresWorkflowDispatchTrigger
  • TAGS="sqlite sqlite_unlock_notify" make test-integration#TestWorkflowDispatchPublicApi

Disclosure

Developed with assistance from OpenAI Codex.

…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.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 11, 2026
@jorgeortiz85 jorgeortiz85 marked this pull request as ready for review May 11, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

workflow_dispatch call via rest api triggers push event

2 participants