Getting info about the last workflow run for a specific ID in GitHub Actions

Viewed 2893

I'm confused, is there any way to get the status of the last workflow run for a specific workflow ID via the API? I don't see a way to do this after reading the REST API documentation on GitHub Actions.

Elaborating, my .github/workflows/ folder in my repository looks like this:

.github/
 |_ workflows/
     |_ deploystaging.yml
     |_ deployprod.yml

Both of these have on-push trigger, so they start building as soon as any commit is pushed.

Now, I want to get info (whether success or fail) about the deploystaging.yml file explicitly via the REST API.

Thank you.

1 Answers

There is an endpoint to list all workflow runs given a workflow id. Every run object contains status with the current run status and completion with the result of the build (tells you if it succeeded or failed).

Related