Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linked commit has the wrong target #115

Open
sdankel opened this issue Feb 8, 2024 · 2 comments
Open

Linked commit has the wrong target #115

sdankel opened this issue Feb 8, 2024 · 2 comments

Comments

@sdankel
Copy link

sdankel commented Feb 8, 2024

The linked commit in the action's comment is incorrect. It links to a commit that says "This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository."

image

Instead, it should be linking to the commit that triggered the workflow run, which is part of the PR branch.

See this comment: FuelLabs/sway#5546 (comment)

Example of the action's comment: FuelLabs/sway#5546 (comment)

Which links to: FuelLabs/sway@c1daf98

@sdankel
Copy link
Author

sdankel commented Feb 8, 2024

This is very weird, since I see the action is only using the sha from github.context

@sdankel
Copy link
Author

sdankel commented Feb 8, 2024

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request

When the event is pull_request, sha is a commit from the merge branch: refs/pull/PULL_REQUEST_NUMBER/merge rather than the PR branch that users see.

When the the event is push, it's the sha that we'd expect. However, branchName: ${{ github.base_ref }} only works with event pull_request.

If the event type is pull_request, the correct commit to use is event.after

  "event_name": "pull_request",
  "event": {
    "action": "synchronize",
    "after": "0cd4b3303ff2bd7987b99570d8a04bcd204a8e76",
    "before": "bc4b6ad9d03ee5652f9e7e917929e3eb18f593f5",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant