Check Suite identifier as an environment variable

To be able to identify all jobs as being part of a specific workflow run, would it be possible to provide a common identifier as part of the default environemnt variables?

Notice, the $GITHUB_SHA is not a good option as it would be the same for several workflow runs (e.g. push and pull_request).

I guess a good choice would be the “check-suite-id”?

Currently, such identifier could be obtained in a very awkward way via the API, by querying the associated with the workflow “check-suite-id”, using the current SHA and the “github-actions” App ID:  

GITHUB\_CHECK\_SUITE\_ID = `curl -s https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/check-suites?app_id=15368 | jq -r '.check_suites[0].id'`

But again, as using $GITHUB_SHA it is not that much better.

It would be nice to also have each job’s “check-run-id” and/or “check-run-name”.

10 Likes

With the new Actions API, there are now $GITHUB_RUN_ID and $GITHUB_RUN_NUMBER environment variables provided.  And they are the same for all jobs in the workflow.

If still needed, to obtain the related check_suite_id (which is different), someone could simply do:

GITHUB_CHECK_SUITE_ID=`curl -s https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} | jq -r '.check_suite_id'`
2 Likes