Some context
Long story short: I am trying to run jest --changedSince=master when I open up a new Pull Request. The jest changedSince flag runs git diff master...HEAD in the background. This results in an error which I can't seem to get my head around.
Current situation
To debug this I have a Github Action which has a step which closely resembles the following:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch --no-tags --depth=1 origin master
git checkout -t origin/master
git checkout pull/1/merge
git diff master...HEAD
This results in the following error (Which is the same error returned by Jest):
fatal: refs/remotes/origin/master...HEAD: no merge base
What I have tried
The problem does not occur when I run this locally (imagine that). I do realise that the biggest issue here is most likely the fact that the actions/checkout@2 action does not fetch the entire repository. That's why I added the git fetch & git checkout -t origin/master and pull/1/merge command.
I did attempt to run git branch -a to debug if this worked as expected, these were the results:
* (HEAD detached at pull/1/merge)
master
remotes/origin/master
remotes/pull/1/merge
All the refs which are required to run git diff master...HEAD seem to be available in the action.
I have also tried to check if the actual ref is returned correctly:
I ran git show-ref master inside the action which returns:
<commit-sha> refs/heads/master
<commit-sha> refs/remotes/origin/master
I am out of ideas on what could cause this issue, any ideas are appreciated greatly!