-
Notifications
You must be signed in to change notification settings - Fork 74
Scenarios for Advanced Input
Some of you have specific syncing needs that aren't covered by default settings, so here's a running list of option configs to help figure things out. These are things that other devs have asked about previously, and if you know of any other great configurations for specific use cases, please share them!
This sync action will not handle merging commit conflicts for you. That's your mess to figure out. However, you can do basic conflict selection between 'theirs' or 'ours' using the upstream_pull_args
input. Be careful with the results.
To overwrite and keep the upstream repo commits => upstream_pull_args: '-s recursive -Xtheirs'
To overwrite and keep the target repo commits => upstream_pull_args: '-s recursive -Xours'
For example - you forked a repo, and then you added this action to the default branch of the repo to keep it synced with the matching upstream branch. Now your target and upstream branches have divergent histories! The sync fails with a git error.
fatal: refusing to merge unrelated histories
This will probably be a very common scenario. 🤷♂️
Another way this happens is if you commit your work on the branch you're syncing. Adding this bit to your input will allow divergent histories to be merged, but keep an eye on your results.
Set => upstream_pull_args: '--allow-unrelated-histories'
I'm actually a bit unclear on this one - perhaps someone experiencing this issue can help clarify?
My current understanding is that either the target repo or the upstream repo get checked out as a shallow copy of the repo, but the other doesn't. This could happen if you set the --depth
option on a pull or fetch, and it can result in an error:
fatal: refusing to merge unrelated histories
...which is a bit misleading.
Instead of allowing unrelated histories, you might try to use the --unshallow
option in your upstream_pull_args
input.
--unshallow
If the source repository is complete, convert a shallow repository
to a complete one, removing all the limitations imposed by shallow
repositories.
If the source repository is shallow, fetch as much as possible so
that the current repository has the same history as the source
repository.