Action does not work with `pull_request` events
skearnes opened this issue · 4 comments
The pull_request
workflow event uses a different value for GITHUB_REF
that does not include the branch name (in contrast to the push
event); instead, it includes information about the PR, e.g. refs/pull/72/merge
. This causes git push
to fail with errors like this:
! [remote rejected] HEAD -> refs/pull/72/merge (deny updating a hidden ref)
I was able to reproduce an issue.
And figured out that in addition to GITHUB_REF
there are some addition env vars: GITHUB_HEAD_REF
, GITHUB_BASE_REF
. And they have diff values on pushes and PRs:
on push:
DEBUG: GITHUB_HEAD_REF:
DEBUG: GITHUB_BASE_REF:
DEBUG: GITHUB_REF: refs/heads/pr-test2
DEBUG: INPUT_TARGET_BRANCH:
DEBUG: BRANCH: pr-test2
on PR:
DEBUG: GITHUB_HEAD_REF: pr-test2
DEBUG: GITHUB_BASE_REF: master
DEBUG: GITHUB_REF: refs/pull/2/merge
DEBUG: INPUT_TARGET_BRANCH:
DEBUG: BRANCH: merge
As you can see it causes some problems with branch name and later with pushing step.
I think now we can use this info to fix this issue
It seems to work now: trsvchn/colab-badge-action-test/pull/9
I am new to github actions so, I used these resources to solve a problem.
Thanks for digging into that!
Thanks for digging into that!
Quarantine gives me too much free time at home)