The dispatches
API should return the run ID
#9752
Replies: 10 comments 23 replies
-
Thank you for your feedback. We are aware of this issue, however, at the moment there are some technical challenges with providing this information. Under the covers the It is something the team is aware of and hope to address in the future. |
Beta Was this translation helpful? Give feedback.
-
In case anyone finds this discussion and is looking for a workaround, I've implemented one in a new PR. The idea is to compare the lists of run IDs before and after the trigger API is called. However, we don't need to fetch the full history of run IDs, only those since a couple of minutes before the trigger, and thankfully the |
Beta Was this translation helpful? Give feedback.
-
Is there a way to maybe expose a specific input from dispatched workflows (e.g. some id generated client-side and passed in when triggering)? We can then query using that, for the exact run-id via the api at a later time, when it is available? (or at the very least be able to "de-race" by inspecting that field for runs that happen at the same time) All that's needed would be to add some whitelisted fields for this in the API? |
Beta Was this translation helpful? Give feedback.
-
Can we please get a return run_ID or job_ID array for the dispatch? It's lack is making completion polling and logging a real PitA. |
Beta Was this translation helpful? Give feedback.
-
So I solved this by injecting a non-used input field and search for it again when retrieving the workflows. This is a very much needed feature imho |
Beta Was this translation helpful? Give feedback.
-
Alternative approach:
This way you don't have to worry about other workflow runs triggering on the same ref. |
Beta Was this translation helpful? Give feedback.
-
Affilitiation: I acknowledge that I am a major contributor to this GitHub Action.
steps:
- uses: lasith-kg/dispatch-workflow@v1
id: dispatch-with-discovery
name: "Dispatch Workflow With Discovery"
with:
dispacth-method: workflow_dispatch | repository_dispatch
...
discover: true
- id: echo-run-id-url
name: "Echo Run ID and Run URL"
run: |
echo "${{ steps.dispatch-with-discovery.outputs.run-id }}"
echo "${{ steps.dispatch-with-discovery.outputs.run-url }}" Naturally, the receiving workflow needs to be modified to intercept this UUID in the
|
Beta Was this translation helpful? Give feedback.
-
Provide an alternative solution I use:
Then you can filter using run-name by the UUID when List workflow runs for a workflow. This call will return run name, then you just filter the matched run instance by the |
Beta Was this translation helpful? Give feedback.
-
For what it’s worth, Jenkins addresses this by issuing a “queue id” at the time of the dispatch request. I imagine they simply generate and id and queue the dispatch. The id is passed back to the caller and then when the job starts, the build record (or workflow in the this case) will now have that id it as a property. Then the developer can query for recent build history for the particular job by name and then client side filter for the one with the id they were given and keep polling until the status comes back indicating the run is complete. Architecturally, it’s pretty straight forward, but I don’t know what the scheduling infra looks like on the GHA side |
Beta Was this translation helpful? Give feedback.
-
Hey there 👋 I apologize I was wrong, we are work on fixing this this quarter, standby for more news on this! |
Beta Was this translation helpful? Give feedback.
-
The Create a workflow dispatch event returns empty content. However, this makes it very difficult to track the workflow that was triggered because getting its ID is inherently 'racy'. The triggered workflow may have finished before you can check for it, or another job may already be running. It would be much better if the API returned the ID of the workflow that was dispatched.
This is an ongoing problem in the convictional/trigger-workflow-and-wait action that's available in the Marketplace, and there's currently a PR open that's trying to fix this, but it's going to be very difficult to make it robust.
Update: I wrote a better PR and it was merged. The finished code now has a robust mechanism for getting the run ID.
Beta Was this translation helpful? Give feedback.
All reactions