Provide URL to Specific Job Step

I’d like to be able to access/provide a link to a specific step in a ran job.

For example, if I wanted to post a comment on a PR providing a link to a specific step that has relevant output to the developer, it would be nice to access it via steps.step_id.url.

In practice, something like this:

- name: post_comment
   id: post_comment
   run: ./post_comment ${{ steps.my-output-step.url }}

Thanks!

So I have a “way” you can do this, but it is a little hacky.

You can actually get the link to a specific step, when looking at the build log in the UI, by clicking on the line number of that step. For example:

will take you to a run of my workflow, open the second step, and place focus on the first line. The “2” in the URL indicates that you want to go to the second step of the workflow. The “1” indicates go to the first line of output for that step.

So, if you know the order of the steps, you can make this work. You can get the workflow run number from the github context object. Then, you can hard-code the step number, along with “1”, and set that into the PR or issue or whatever. Yes, if you modify the order of the steps in your job, then you have to fix this, but it would work.

2 Likes

Ah, I had no idea! It is a little hacky, but it’s good enough as far as a working solution goes :+1:

Appreciate it!

FYI I’m including this example in a talk I’m giving in June. :slight_smile:

Awesome! I’d be interested in tuning in if it’s available online anywhere :+1:

1 Like