You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Default Branch should be triggered branch not Master #38
The reason for this is because i was having hair pulling troubles trying to figure out how to get this action to push to the branch that triggered the script. Due to the complexity of github actions.
In addition, this Action name's "intent" is just push, which by default I would expect it to only push on the triggered branch, not merge to master.
Either it should by default push to trigger branch or give the example to do so in the readme file.
Reacted by Barret Schloerke, Olivier Le Floch, Horus Lugo, Enrique García Galán, William Johnes, Ian Sanders, Yishai Burt, aelesia, James, Thomas Wang and 29 more
The advantage of the latter approach is that the script will also work when triggered in a push. Otherwise, it will only work in a pull_request event. (As far as I did not do something wrong in my experiements this morning. There, the variable github.head_ref was empty in the case of a push event)
The advantage of the latter approach is that the script will also work when triggered in a push. Otherwise, it will only work in a pull_request event. (As far as I did not do something wrong in my experiements this morning. There, the variable github.head_ref was empty in the case of a push event)
The former works for push for me. See action script.
Heres a screenshot of github action trigger that was successful in committing to master from a push onto master.
Do you know if an empty HEAD: defaults to master?
If so then thats probably how mine is working and my script isnt doing what i think its doing 😅.
im not familiar with git command line.
I set our CI to use this plugin to push only tags. So I didn't set branch and I thought that it will push only tags. But a very weird thing happened. Every time our workflow finished a deploy from any branch it 'force' pushes the current branch to the master. 😲
Maybe I did not read the documentation properly but I still think that if I don't specify the branch, it should push to the current or doesn't push branch at all.
Reacted by Aaron Cooper, Tom Herrmann and Benjamin Schulte
The advantage of the latter approach is that the script will also work when triggered in a push. Otherwise, it will only work in a pull_request event. (As far as I did not do something wrong in my experiements this morning. There, the variable github.head_ref was empty in the case of a push event)
branch: ${{ github.head_ref }} is to change on which branch it comes from. How to make it push on the committer fork instead of the upstream on pull request?
Activity
DavidGOrtega commentedon Dec 18, 2019
or
branch=${GITHUB_REF#refs/heads/}inside your action
koppor commentedon Jan 2, 2020
+1 for defaulting to current branch. I like the solution by @DavidGOrtega. Could you please update the code and the README.md accordingly?
Snazzie commentedon Jan 2, 2020
Out of curiosity, is there a difference between
${{ github.head_ref }}and${GITHUB_REF#refs/heads/}?koppor commentedon Jan 2, 2020
The former is for the
.ymlfile (Syntax: GitHub Actions), the latter is inside https://github.com/ad-m/github-push-action/blob/master/start.sh (Syntax: Bash).The advantage of the latter approach is that the script will also work when triggered in a
push. Otherwise, it will only work in apull_requestevent. (As far as I did not do something wrong in my experiements this morning. There, the variablegithub.head_refwas empty in the case of apushevent)Snazzie commentedon Jan 2, 2020
Ahh fair enough
The former works for push for me. See action script.
Heres a screenshot of github action trigger that was successful in committing to master from a push onto master.

Snazzie commentedon Jan 2, 2020
Do you know if an empty
HEAD:defaults to master?If so then thats probably how mine is working and my script isnt doing what i think its doing 😅.
im not familiar with git command line.
📚 how could I about this without documentationgit add .github/workflo…
jcislinsky commentedon Jan 31, 2020
I set our CI to use this plugin to push only tags. So I didn't set branch and I thought that it will push only tags. But a very weird thing happened. Every time our workflow finished a deploy from any branch it 'force' pushes the current branch to the master. 😲
Maybe I did not read the documentation properly but I still think that if I don't specify the branch, it should push to the current or doesn't push branch at all.
Gummibeer commentedon Feb 8, 2020
@koppor
You can use the
refinstead ofhead_reffor push events.https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
fix: when updating changlelog push back to pull request
fix: when updating changlelog push back to pull request
fix: when updating changlelog push back to pull request (#56)
Cookie cutter support (#47)
Fix pushing refs error - ad-m/github-push-action#38 (comment)
yasirroni commentedon Apr 14, 2022
branch: ${{ github.head_ref }}is to change on which branch it comes from. How to make it push on the committer fork instead of the upstream on pull request?ZPascal commentedon Apr 16, 2022
Hi @yasirroni,
if understand your question correctly, you wanna push inside an PR scenario in the fork, correct?
You can try the following parameters:
ZPascal commentedon May 23, 2026
I'll close the issue. The configuration is already documented inside the
README.md.