4

I am looking for an API to retrieve previous runs of a specific workflow in GitHub Actions. I found the API that returns the previous runs of my entire repository, but I only need the runs of a specific workflow.

This link perfectly describes what I am looking for as an API: https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/viewing-workflow-run-history

1 Answer 1

5

Use the /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs endpoint to list the runs of a given workflow ID in a given repository.

For example, to get all of the runs of the CI job for the rust-lang/rust repository, use https://api.github.com/repos/rust-lang/rust/actions/workflows/817415/runs.

Sign up to request clarification or add additional context in comments.

3 Comments

where did you get the id? According to docs, we can pass workflow file name also, but it is not working for me.
@BhushanKarmarkar this endpoint has all the workflow IDs: api.github.com/repos/rust-lang/rust/actions/workflows
I see, the problem is I've set up repository ruleset to run a workflow before merge. The workflow file is in another repository. May be this is the reason I am getting Http 404. I am not sure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.