docs icon indicating copy to clipboard operation
docs copied to clipboard

github.sha description in "`github` context" section of "Contexts" page is missleading

Open Andre601 opened this issue 3 years ago • 3 comments

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/learn-github-actions/contexts

More precisely the section "github context": https://docs.github.com/en/actions/learn-github-actions/contexts#github-context

What part(s) of the article would you like to see updated?

The information about github.sha is misleading and (partially) wrong when it comes down to pull_request and pull_request_target workflows.

The description reads as follows:

The commit SHA that triggered the workflow run.

In the case of the aforementioned workflow types is this not true. In those cases is not the actual commit made in the PR used, but the last commit SHA from the target branch of the PR.

This means that if I push commit 123abc to my branch and the target branch of the PR is 456def would ${{ github.sha }} return 456def instead of 123abc which would make more sense due to it being the commit that triggered the pull_request(_target) event.

Additional information

No response

Andre601 avatar May 11 '22 14:05 Andre601

@Andre601 Thanks so much for opening an issue! I'll triage this for the team to review :eyes:

ramyaparimi avatar May 11 '22 15:05 ramyaparimi

Thanks for opening an issue! We've triaged this issue for technical review by a subject matter expert :eyes:

github-actions[bot] avatar May 11 '22 15:05 github-actions[bot]

This is a gentle bump for the docs team that this issue is waiting for technical review.

github-actions[bot] avatar May 18 '22 20:05 github-actions[bot]

This is still unclear IMO. The events that trigger workflows docs refer to "context of the base of the pull request" and "context of the merge commit", but those terms are not defined anywhere.

Questions:

This context includes the workflows as they are in the base branch. How about the code itself? What is the value of github.sha for a pull_request_target event?

Pwuts avatar Apr 18 '23 12:04 Pwuts