rtCamp/action-slack-notify

Current `Actions URL` is not useful when an action runs many times on the same commit, it shows many runs and it's impossible to say which one triggered the notification.

Closed this issue ยท 5 comments

The current Actions URL point to (https://github.com/org/repo/commit/sha/checks)

For example https://github.com/prisma/language-tools/commit/1e465e035ebd81650ec70146fd14cd4a943b29a2/checks
This example has a quite a few actions runs on the same commit which makes it really hard to know which run triggered the notification
Screen Shot 2022-01-04 at 17 22 09

My current workaround is to change the footer with the link to the actual run like this

      - name: Set current job url in SLACK_FOOTER env var
        if: always()
        run: echo "SLACK_FOOTER=<$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID|Click here to go to the job logs>" >> $GITHUB_ENV

Which looks like this
Screen Shot 2022-01-04 at 17 26 21

It works very well but it would be amazing (and less YAML ๐Ÿ˜…) to have something like this directly implemented in this action.

I could see different options

  • Change the default Action URL
  • Same but only opt-in with a param?
  • Recommend this workaround (not the best)

What are your thoughts?

shino commented

Same issue on me!

I read github actions doc a bit, and found GITHUB_RUN_ID
https://docs.github.com/en/actions/learn-github-actions/environment-variables

A unique number for each workflow run within a repository. This number does not change if you re-run the workflow run. For example, 1658821493.

It can help if one can construct the URL to current workflow run with this ID as
https://github.com/<user>/<repo>/runs/<GITHUB_RUN_ID>?check_suite_focus=true , right?

shino commented

Oops, the url construction is already explained in the description ๐Ÿ˜“

This one has been resolved in #162, and would be available for use as soon as the new build is published. Credits to @shino for giving a workaround.

Thanks ๐Ÿ™Œ๐Ÿผ ! I'm curious to check this once it's released!