Pull requests events by default check out the merge commit ref. Alternatively, the pull request head can be checkout using:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
However, in successive actions it is not possible to detect whether the action uses another ref. github.context.sha still references the merge commit. See for example the discussion on: jwgmeligmeyling/pmd-github-action#2
It would be nice if actions/checkout@v2 somehow made the checkout ref available as output or exported variable.
Or am I overlooking an existing approach to obtain the checked out commit SHA?
Pull requests events by default check out the merge commit ref. Alternatively, the pull request head can be checkout using:
However, in successive actions it is not possible to detect whether the action uses another ref.
github.context.shastill references the merge commit. See for example the discussion on: jwgmeligmeyling/pmd-github-action#2It would be nice if
actions/checkout@v2somehow made the checkout ref available as output or exported variable.Or am I overlooking an existing approach to obtain the checked out commit SHA?