Skip to content

Master commit hash on a pull request action #26506

Answered by BrightRan
beldar asked this question in Actions
Discussion options

You must be logged in to vote

@beldar ,

You can use the property " github.event.pull_request.head.sha" from the github context to fetch the commit hash for the PR’s head.
Similarly, you also can use " github.event.pull_request.base.sha" to fetch the commit hash for the PR’s base (master in your case).

You can print the github context information to the logs to fetch more detailed information about the PR.

- name: Dump GitHub context
  env:
    GITHUB_CONTEXT: ${{ toJson(github) }}
  run: echo "$GITHUB_CONTEXT"

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants