Github Actions url to run

Hi!

I’m trying to create a workflow for deployment, and I’d like to create a deploy status and submit the url to the log of the action that deployed. Very handy if the deply failes I think. Using actions/bin/debug I can’t seem to find any reference to the id of the run or url to the run.

Is there a way to extract this in some way?

15 Likes

We don’t currently expose that information, however I’ve made a note of this feedback so we can take it into account as we continue to improve actions.

12 Likes

Thanks! It would perhaps be great to have it as one of the environment variables. GITHUB_RUN_ID or something along those lines.

9 Likes

I have similar use case. Would be nice to have this.

2 Likes

Any updates on this now with the launch of CI/CD support? 

Exposing the run ID would be really helpful for supporting parallelization for Cypress users.

4 Likes

I was just trying to solve this problem recently, this is what I ended up with in the mean time to just set the deployment url:

https://github.com/deliverybot/status/blob/master/index.js#L7

1 Like

@mcolyer has there been any movement on this item?

As requested in https://github.community/t5/GitHub-Actions/Check-Suite-identifier-as-an-environment-variable/m-p/35498#M2240, having GITHUB_CHECK_SUITE_ID would allow provision of such URL as follow:

GITHUB_WORKFLOW_URL=https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA/checks?check_suite_id=$GITHUB_CHECK_SUITE_ID
1 Like

Hi @mcolyer 

Another example would be, if I want to send a Slack message with a link to my GitHub Actions run in case if it sucessed, failed or canceled, I want a varible that points to:

https://github.com/{account-name}/{repository-name}/commit/{git-sha}/checks?check_suite_id={run-id}

Best Wishes,

  • Oleg
7 Likes

With the new Actions API, there are now $GITHUB_RUN_ID environment variable provided. 

Using it, a URL to the workflow could be constructed as follows: 

GITHUB_WORKFLOW_URL=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID

Щіро Вам дякую,і налоштовуємося на співпрацю,і врю в успіх співпраці.

Does that actually work for you? My run IDs are different than the numbers in the URLs. And using the run ID like that results in a 404.

Edit: Aha! I’m wrong. There’s \<repo\>/actions/runs/\<id\> that shows all the jobs and \<repo\>/runs/\<some-other-number\> once you start clicking into jobs. The first one works as you say. My mistake!

2 Likes

Formatting got weird there—sorry.

Does anyone know how to get that URL for the current job in the current run? GITHUB_RUN_NUMBER looks promising but doesn’t seem to be related to the URLs at all.

Yeah! It would be great to have the id of the current job to be able to construct a link for that too! Currently, this is not possible.

I think this should do it @dominikfoldi @samuela
https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID

We are currently using it in our action for updating the deployment status https://github.com/unacast/actions-github-deployment-status/blob/d6be60b7d328f52d8a329119f39add23737be3da/bin/deployment-create-status#L14

No. That will link to the workflow run which has one or more jobs. The jobs have their own dedicated ids, so they have their own links, too.

1 Like

Ah, sorry. Then I understand. And I don’t know.

The job run IDs don’t seem to be exposed in actions, at least per the documentation. Might be worth to print all contexts etc. to check whether this information is available but undocumented.

Other than that, you may use the API to get the job ids:

https://api.github.com/repos/{owner}/{repo}/actions/runs/{run_id}/jobs