API to get workflow run associated with an issue

Hi!

We are working on implementing some tests for our GitHub Actions and we want to be able to get the triggered workflow run for a newly created issue (to test our action that triggers on issue creation). Seems like there’s no such thing right now and we are using barbaric ways such as downloading all recent workflow run logs and check their contents :scream:

Is there a better way or can we convince anyone on the team to get us such an API?

1 Like

:wave: Hey @byk,

I’d recommend using the Workflow Runs API to query for the specific workflow that you expect to trigger.

https://docs.github.com/en/rest/reference/actions#list-workflow-runs

If there are multiple workflows, you can query all runs and filter to issue event.
https://docs.github.com/en/rest/reference/actions#list-workflow-runs-for-a-repository

1 Like