-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Describe the feature or problem you’d like to solve
Currently there is no clear or clean way to determine the ID of the run when dispatching:
$ gh workflow run 'test.yml' -R owner/repo --ref branch_name_or_command_fails
✓ Created workflow_dispatch event for test.yml at branch_name_or_command_fails
To see runs for this workflow, try: gh run list --workflow=test.yml
- The suggested list command does not work as it needs to be pointed to the correct repository (bug on the output?)
- The list command simply lists the runs, it does not indicate which run you have dispatched
I found many many threads requesting this in various ways, to list a couple:
- How to get run_id after workflow_dispatch?
- Getting Run ID of Manually Invoked Workflow Using REST API
- Associate deployment with workflow check run
- Correlate workflow triggered externally with the exact workflow run
I would have raised something in the community but due to a limitation with the community login I cannot login with my GH account (it doesn't like the - in my name).
Currently the only (very awful) way that I have managed to connect the dots between a dispatched action and the action run itself is by using an input, outputting it via echo, and filtering through the log output for every run until it matches. Once I have this ID, using a custom action, poll the API until the run times out or completes and then resolve the source / dispatching action with the result.
There's many issues with this, but the bigger problem is that there doesn't seem to be any way to get the dispatched action run ID back from the API or commands when dispatching.
Proposed solution
Add a flag that waits for the API to return an ID for the dispatched workflow run or simply return it. A flag to only return the ID would make it a lot easier to consume for polling / awaiting the result of the run.
This would remove a lot of the song & dance around trying to connect the dots between a dispatching repo and the foreign run of the action.
I sincerely hope I have grossly misunderstood something or missed "that one page" that says how this should be done correctly, but based on the amount of threads around this I feel like I might be disappointed.