Workflow dispatch API now returns run IDs
Source: GitHub Changelog
Overview
When you trigger a workflow using the GitHub Actions workflow dispatch API endpoint, you can now receive metadata in the response that helps you map your request to the corresponding workflow run.
- Previously, this endpoint returned only a
204 No Contentstatus code. - By passing the new optional boolean parameter
return_run_details, the API returns a200 OKresponse containing:- the workflow ID
- the API URL
- the workflow URL
If the parameter is omitted, the endpoint continues to return 204 No Content.
GitHub CLI Support
This capability is also supported in the GitHub CLI as of v2.87.0.
- Trigger a workflow dispatch via
gh workflow run. - The CLI returns the URL for the created run, which can be viewed with
gh run view. - The newest CLI version defaults
return_run_detailstotrue.
Benefits
Developers can now easily identify which workflow runs originated from their API calls, eliminating the need for extensive polling or custom tracking solutions.
Learn more about the workflow dispatch API in the GitHub Actions documentation.