Skip to content

Unexpected value for github.event.pull_request.base.sha #1689

@JensDll

Description

@JensDll

Describe the bug
In a workflow run on pull_request, the github.event.pull_request.base.sha does not always seem to be the real pull request base. At the time of opening the pull request, it will have the SHA of the latest commit in base.ref. That seems unexpected because really it should have the SHA of the commit since creating the branch, right?

To Reproduce
Steps to reproduce the behavior:

  1. Create a workflow run on pull_request, logging the github context.
  2. On some branch a create a new branch b.
  3. Make commits on a.
  4. Make commits on b.
  5. Push the changes from a.
  6. Push the changes from b and open a pull request.

Let's assume the history looks like below:

a  0 --- 1 --- 2
b     +  3 --- 4

Expected behavior
github.event.pull_request.base.sha is 0

Actual behavior
github.event.pull_request.base.sha is 2

Runner Version and Platform

Version of your runner?
2.287.1

OS of the machine running the runner?
GitHub-hosted ubuntu-latest version 20.04.3

Job Log Output

I recreated the steps above and described the behavior once more. Here is the pull request:

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions