Search code examples
github-actionsworkflowgithub-apistatus

How to retrieve all the executions of a workflow by multiple status through the GitHub API?


According to the API documentation to retrieve all executions of a workflow by a status we can use this command:

curl \
  -H "Accept: application/vnd.github+json" \ 
  -H "Authorization: token <TOKEN>" \
  https://api.github.com/repos/OWNER/REPO/actions/workflows/WORKFLOW_ID/runs?status=in_progress

... But is there a way to retrieve all the executions of a workflow by multiple status with one command instead to launch multiple command?


Solution

  • I tried this command where there are multiple status parameters in the query string:

    curl \
      -H "Accept: application/vnd.github+json" \ 
      -H "Authorization: token <TOKEN>" \
      https://api.github.com/repos/OWNER/REPO/actions/workflows/WORKFLOW_ID/runs?status=in_progress&status=queued&status=requested
    

    This solution doesn't return the expected result: so with this rest method you have to make a call for each status you need to retrieve information