Description
I am coming from dependabot/dependabot-core#3253, where there is a lot of confusion of how to safely run actions with secrets when untrusted code from external PRs comes into play.
The bottom line is that there may be situations where you – after you understood the risks – might want to use the pull_request_target
event because it has access to secrets; but combine that with a checkout of the PR.
One suggested way of doing this is with
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
which will check out the PR head commit.
This is, however, not 100% what you'd get for a simple uses: actions/checkout@v2
on a pull_request
event, because that would check out a merge commit.
I wonder whether it would be possible for this action here to also support checking out such a merge commit on pull_request_target
events?
I don't know if creating such a merge commit involves advanced Git trickery to get-it-right™️ , so I thought this was the best place to ask.