Closed koppor closed 3 years ago
Thanks for reporting! I can see the pain point here.
However, I'm really hesitant to solve this issue within git-auto-commit
. The main goal of the Action is to "commit and push" and not necessarily to resolve issues when the push fails due to the local version to be out of date (but I can also see reasons why this Action should solve these problems).
Adding support for both git rebase
and git merge
strategies is just something I'm not keen on adding; I would like to keep this Action as basic as possible. Hence the "80% use case" in the README.
I keep a private note with ideas for v5. Added solving such problems to that note.
In the meantime, I'm sorry to say you have to solve this issue yourself in your Workflow. Feel free to share your solution here, so others can benefits from it.
I will also update the Limitations section in the README in the next days. Will add "running in a build matrix" to that list.
I finally found a working solution - unfortunately, by switching to another action: https://github.com/marketplace/actions/add-commit
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
message: 'Update files based on generated files by template generator'
pull_strategy: 'NO-PULL'
push: false
- name: Push changes
run: |
git pull --rebase
git push
Since I seem to be the only one asking here for such a thing and I found a workaround, I will close the issue.
@koppor I'm glad you could solve the problem.
I've added a link to the add-commit
Action to the README, so others can learn and use it if git-auto-commit
doesn't help in their workflows.
@stefanzweifel Thank you for adding the link.
The solution sketched above is written in length at https://github.com/EndBug/add-and-commit/issues/262#issuecomment-901473894.
I finally found a working solution - unfortunately, by switching to another action: https://github.com/marketplace/actions/add-commit
- name: Commit changes uses: EndBug/add-and-commit@v7 with: message: 'Update files based on generated files by template generator' pull_strategy: 'NO-PULL' push: false - name: Push changes run: | git pull --rebase git push
Since I seem to be the only one asking here for such a thing and I found a workaround, I will close the issue.
@koppor if I want more assurance, how to add some retry loops to the run:
commands?
@koppor I'm glad you could solve the problem. I've added a link to the add-commit Action to the README, so others can learn and use it if git-auto-commit doesn't help in their workflows.
@stefanzweifel would git-auto-commit
consider adding some git pull --rebase
retry support for this?
@fritx
would git-auto-commit consider adding some git pull --rebase retry support for this?
No, there are no current plans to add support for retries using git pull
or git pull --rebase
. (Maybe in a new major version, but I haven't started working on that.)
This I a can of worms I just don't want to open. This Action showed me, that people are using git
in so many different ways.
See also https://github.com/stefanzweifel/git-auto-commit-action#limitations--gotchas.
@stefanzweifel OK. My case is that I have multiple jobs concurrently triggered that commit separately to the same branch.
So it can have concurrent problem sometimes with git-auto-commit
Is your feature request related to a problem? Please describe.
I am running a build matrix, where each job updates another file. I want to have all updates committed. The second job outputs the following error:
Describe the solution you'd like
The action should do a pull if it encounters "non-fast-forward" as push result and then retry. In case it encounters that again, it should do another retry. It should do so until it succeeds (or maybe 100 tries are reached).
Describe alternatives you've considered
One could issue
git fetch
just before the action (similar to the proposal at https://github.com/stefanzweifel/git-auto-commit-action/issues/142#issuecomment-784444823). However, if first job 2 rebases, then job 3, then job 2 commits and then job 3 commits, job 3 still fails.I also tried
skip_fetch: false
, but I still encounter this issue.This is not https://github.com/stefanzweifel/git-auto-commit-action/issues/102, because it is not a shallow update.