-
Notifications
You must be signed in to change notification settings - Fork 73
Scenarios for Advanced Input
Many sync use cases are not covered by default configurations. This page is a running running list of optional settings to assist with your needs. I encourage you to share your unique configurations if you have needed something special to solve your use case.
This sync action will not handle merging commit conflicts for you. However, you can implement basic conflict selection between 'theirs' or 'ours' using the upstream_pull_args
input.
- Keep upstream repo commits =>
upstream_pull_args: '-s recursive -Xtheirs'
- Keep 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 can also happend if you commit your work to the branch you're syncing. Add this to allow divergent histories to be merged.
upstream_pull_args: '--allow-unrelated-histories'
My current understanding of this 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
It's a somewhat misleading error. 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.