dmnemec / copy_file_to_another_repo_action

This GitHub Action copies a file from the current repository to a location in another repository
Apache License 2.0
182 stars 201 forks source link

Add retry with pull just before pushing to avoid errors #85

Open omerd-cyera opened 9 months ago

omerd-cyera commented 9 months ago

Hi, First of all, thanks for the great extension, Its really helpful.

I'm running into issues when using this action to push into the main branch of another repo. The other repo has a pretty high commit rate, so every once in while i get a:

error: failed to push some refs to 'github.com:____.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details

I think adding a git pull right before the commit, or after with some merge or rebase flag could be very useful. We could add a retry count option, and maybe another option for custom git pull flags.

I have the time and willing to open a PR. Is this something agree with and want to add?