Also see Workflow dispatch - can't set ref to commit SHA
A commit hash isn’t supported, but tags are accepted by the REST API.
curl \
-d '{"ref":"{tag}"}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: token {access-token}' \
'https://api.github.com/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches'
The expected reply in case of a successful dispatch is HTTP/1.1 204 No Content
without payload.
Depending on the shell you use, it will require a slightly different syntax for the curl command. For example, in PowerShell Core, there is a long-standing issue with quoting. The data part needs special escaping:
- single quoted string,
"
escaped as \"
:
-d '{\"ref\": \"...\"}'
– or –
- double quoted string,
"
escaped as \`"
:
-d "{\`"ref\`": \`"...\`"}"
(Note that this was tested with actual curl, not the aliased command for Invoke-WebRequest)