Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 1 of 2

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${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".


1 Reply
Copilot Lvl 3
Message 2 of 2

Re: Check Suite identifier as an environment variable

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${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} | jq -r '.check_suite_id'`