Search code examples
githubgithub-actionsgithub-api

GitHub Actions API: Get view workflow run history


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


Solution

  • 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.