Access current check run name or id from Action

Is it possible to get current check run name or ID from inside the action somehow? I would like to update it with annotations and summaries generated by the action so that I do not have two separate statuses for the action itself and its output.

Until recently I could just create a new check run with the same (hardcoded) name and I would get just one item in the checks view. However this is no longer possible as creating a new check run with the same name now actually creates a new check run with the same name instead of just replacing the existing one, resulting in two identical items in checks view.

There’s no way I know of to get the actual name or id of a step, but there is the GITHUB_ACTION environment variable that tells you what step is currently running, for example the first step will be “run1”, the second one “run2” and so on. So it’s not the exact name/id of your step, but it is a way to identify what step you are currently in.

I would also advocate for having the check run id available in either the github context or as a separat environment variable. When updating check runs with annotations it’s necessary to have the id of the check run in order to update the correct one, especially when using matrix builds where multiple parallel jobs are running. Currently my workaround consist of including an environment variable in the matrix job that contains a string which is unique to each name of the matrix jobs.

1 Like