sarisia/actions-status-discord

Workflow link points to a non-existent commit on pull requests

kory33 opened this issue · 3 comments

Issue description

For workflows triggered by pull_request events, the workflow link points to a commit that does not belong to the repository.

For example,
image
the link above goes to https://github.com/GiganticMinecraft/SeichiAssist/commit/695bf7133c95640b663f4e817f84f300874ca809/checks, while I expect it to go to https://github.com/GiganticMinecraft/SeichiAssist/commit/2cb1b549800285c790832a45d71e17e21fd85faf/checks.

I believe the link uses SHA hash of a merge commit automatically generated by Actions, which is different from github.sha.
EDIT: My bad, this is in fact the expected github.sha, but would it be reasonable to use github.event.pull_request.head.sha when this is available?

Reproduction

Set up a workflow with sarisia/actions-status-discord@v1, trigger it with pull_request event and check the link generated for "Workflow" column.

Full workflow file

Hi @kory33 , thank you for raising the issue!

This is obviously a bug and I’ve identified the cause.

I’ll fix it soon.

I believe the link uses SHA hash of a merge commit automatically generated by Actions, which is different from github.sha.
EDIT: My bad, this is in fact the expected github.sha, but would it be reasonable to use github.event.pull_request.head.sha when this is available?

Oh, I haven't noticed these lines you added.

Yes, checking github.event.pull_request.head.sha first seems to be the reasonable way to fix this. Thanks!

The fixed version is now released as v1.8.5. Thanks!
https://github.com/sarisia/actions-status-discord/releases/tag/v1.8.5