In my Github Action, I need to clone another repo on the same branch as the one that triggered the workflow.
So if that was a push to master
, then I need to clone the remote repo on the master
branch.
And if it was a pull request from the feature/xxx-yyy
branch, I need to symmetrically clone the remote repo on the feature/xxx-yyy
branch.
I reckon I can use ${GITHUB_HEAD_REF}
in the case of pull_request
, but it seems it won't work with push.
- uses: actions/checkout@v3
with:
repository: 'my-org/e2e-tests'
ref: ${GITHUB_HEAD_REF}
token: '${{ secrets.CI_PAT }}'
path: 'e2e'
Any bits of advice on how to do that?