I am having the same issue but in my case the workflow yaml is on the default branch main
I can dispatch the workflow if I specify ref
as main
or refs/heads/main
but it fails if I try any other branch
$ curl -X POST -H "Accept: application/vnd.github.v3+json" -H 'Authorization: token ***' https://api.github.com/repos/HarikrishnanBalagopal/yohoo/actions/workflows/fooworkflow.yml/dispatches -d '{"ref":"refs/heads/foo"}'
{
"message": "Workflow does not have 'workflow_dispatch' trigger",
"documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event"
}
To be clear this error is different from the error for non existent workflows:
$ curl -X POST -H "Accept: application/vnd.github.v3+json" -H 'Authorization: token ***' https://api.github.com/repos/HarikrishnanBalagopal/yohoo/actions/workflows/fooworkflowsss.yml/dispatches -d '{"ref":"refs/heads/hmmm"}'
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event"
}
and this error is also different from the error for non-existent branches:
$ curl -X POST -H "Accept: application/vnd.github.v3+json" -H 'Authorization: token ***' https://api.github.com/repos/HarikrishnanBalagopal/yohoo/actions/workflows/fooworkflow.yml/dispatches -d '{"ref":"refs/heads/weird"}'
{
"message": "No ref found for: refs/heads/weird",
"documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event"
}