Reputation: 4234
Given a Github Action for a pull request, I would like to get the list of all the commits in that PR / branch. I can do git log master..
but it fails in the Action:
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- run: git log ${{ github.event.pull_request.base.ref }}..
fatal: bad revision 'master'
Any hint why that fails?
Upvotes: 0
Views: 1679
Reputation: 4234
This action misses a git fetch
. The other branches can then be accessed with the origin/
prefix.
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- run: git fetch
- run: git log origin/${{ github.event.pull_request.base.ref }}..
Upvotes: 1