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
This action works well for me, but occasionally I am running 2 of them at the same time and one will push changes in the middle of another one pulling the changes and then pushing.
It would be convenient if there was a pull_first: true option that would re-issue the git pull right before pushing to avoid a push conflict. Force is not the option as that will overwrite the other push changes (and ruin history).
Reacted by Jonathan Beliën, RuiLoureiro, Vinay Keerthi, LM, Ty Balduf, Alexis Lucattini, Saransh Chopra, 郭飞, Devon Hubner, Shaun and 9 more
@ad-m while the concurrency means that the jobs don't run simultaneously, they still run from the one original commit.
Whilst concurrency will stop 'race conditions' of two actions pushing commits to the repo at the exact same time, it won't fix the issue because the second push will always fail because it hasn't merged the commit of the first push.
Any ideas on this? We are seeing this error when lots of GitHub actions fire closely together and errors with:
Run ad-m/github-push-action@master
Push to branch master
To https://github.com/Acme-Org/DevOps.git
! [rejected] HEAD -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Acme-Org/DevOps.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Error: Invalid exit code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:29:21)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1022:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:28[7](https://github.com/Acme-Org/DevOps/runs/6603223590?check_suite_focus=true#step:4:8):5) {
code: 1
}
Error: Invalid exit code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:29:21)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1022:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:2[8](https://github.com/Acme-Org/DevOps/runs/6603223590?check_suite_focus=true#step:4:9)7:5)
Hi @nodesocket, do you tried git pull or git pull --rebase origin "${GITHUB_REF}" beforehand? You can include the command inside the commit/ configuration area, e.g.
@nsheff I think the point sounds valid to include a flag to pull the repository beforehand. I'll check how to include the functionality and prepare a PR.
@ZPascal the action definition just does a checkout, runs a custom bash script which takes 1-2 seconds and then calls push. Do you spot anything or a solution? Are you recommending to call pull right before push?
Activity
alexiswl commentedon Jul 5, 2021
I just run code inside the runner directly now rather than calling this action:
You may find this latest update https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/ quite useful. Setting
concurrencyon your jobs means your workflows are run in sequence rather than sequentiallyad-m commentedon Jul 10, 2021
@alexiswl Could you provide pull request to README of
github-push-actionto add note aboutconcurrencysettings?alexiswl commentedon Jul 12, 2021
@ad-m while the concurrency means that the jobs don't run simultaneously, they still run from the one original commit.
Whilst concurrency will stop 'race conditions' of two actions pushing commits to the repo at the exact same time, it won't fix the issue because the second push will always fail because it hasn't merged the commit of the first push.
nodesocket commentedon May 26, 2022
Any ideas on this? We are seeing this error when lots of GitHub actions fire closely together and errors with:
Is there a way to perform a pull/rebase before?
ZPascal commentedon May 26, 2022
Hi @nodesocket, do you tried
git pullorgit pull --rebase origin "${GITHUB_REF}"beforehand? You can include the command inside the commit/ configuration area, e.g.@nsheff I think the point sounds valid to include a flag to pull the repository beforehand. I'll check how to include the functionality and prepare a PR.
nodesocket commentedon May 26, 2022
@ZPascal the action definition just does a checkout, runs a custom bash script which takes 1-2 seconds and then calls push. Do you spot anything or a solution? Are you recommending to call pull right before push?
ZPascal commentedon May 31, 2022
Hi @nodesocket, I would recommend trying a pull beforehand. I've got one question: Your bash script does the rest (git config, git add, git commit)?
nodesocket commentedon May 31, 2022
@ZPascal correct, in my bash script I am doing the following:
Should I just add
git pull --rebaseat the end, after the commit?ZPascal commentedon May 31, 2022
Hi @nodesocket, yes. I think that should solve the issue.
kevupton commentedon Aug 3, 2022
this package should totally have pull as an optional parameter.
ZPascal commentedon May 20, 2026
I'll put the topic on my TODO list. I think it makes sense to contribute the feature.
ZPascal commentedon May 23, 2026
The feature is implemented and realized in #373.