stefanzweifel / git-auto-commit-action

Automatically commit and push changed files back to GitHub with this GitHub Action for the 80% use case.
MIT License
1.97k stars 226 forks source link

Add option for pulling the changes before pushing #229

Closed eugene-bright closed 2 years ago

eugene-bright commented 2 years ago

Is your feature request related to a problem? Please describe. Force pushing is not safe. New commits that came in the window before workflow start and force push will be lost

Describe the solution you'd like We can try to perform pull before pushing to make it more successful and safer

stefanzweifel commented 2 years ago

Thanks for reporting.

This is a known edge case of the Action:

The following is a list of edge cases the Action knowingly does not support: No git pull when the repository is out of the date with remote. The Action will not do a git pull before doing the git push. You are responsible for keeping the repository up to date in your Workflow runs.

I don't have any plans on adding options to "fix" this. User will have different preferences to either use git rebase or git merge. There will be merge conflicts that need to be handled. The list goes on. :)

I suggest adding a new step to your workflows to always run git pull before attempting to create the commit

- name: Pull Remote Changes
  run: git pull

I hope that solves your particular problem. I keep a list of features to be added to the next major version. git-pull is on the list.