When trying to keep in sync with upstream using the GitHub Action sync-panther-analysis-from-upstream, the following error occurs:
sync-panther-analysis-from-upstream: all jobs have failed
The job stopped working.
If you are experiencing an issue while trying to run this over a private mirrored panther-analysis repo, also see this article: Error 'fatal: refusing to merge unrelated histories' when running GitHub action sync-panther-analysis-from-upstream over private mirrored panther-analysis repo
To resolve the "all jobs have failed" error:
Clone your organization’s repo.
gh repo clone your-org/panther-analysis-copy
Checkout the primary branch.
git co master
(or main
)
Fetch and pull everything from your repo.
git fetch && git pull
Checkout the sync branch.
git checkout sync_upstream_v1.44.0
Make sure to replace 1.44.0 with the correct version.
Ensure that you have the upstream panther-analysis as a git remote.
git remote -v
If not, please follow the section below titled "Add upstream panther-analysis as a git remote."
Fetch the upstream.
git fetch upstream
Merge in the failing upstream branch to your local sync branch.
git merge v1.44.0
Make sure to replace 1.44.0 with the correct version.
Resolve the merge conflicts.
Run git status
to check your status.
Resolve the merge conflicts:
Take the file from upstream:
git checkout --theirs $filename
Keep the local edits and discard upstream’s changes:
git checkout --ours $filename
If you need to make other changes:
edit $filename
Add the conflicting file as resolved:
git add $filename
After addressing the files, you can commit the changes:
git commit
Push the resolved merge to your local sync branch
git push origin sync_upstream_v1.44.0
Make sure to change 1.44.0 to the correct version.
Now you can open a pull request from your local sync branch to your local repo.
If you do not have the upstream panther-analysis as a git remote, follow these instructions to add it:
git remote -v
git remote add upstream https://github.com/panther-labs/panther-analysis.git
git remote -v
Merge conflicts and related issues can be occur for a variety of reasons depending on changes that have been made downstream. They typically occur when two separate branches have made edits to the same line in a file, or when a file has been deleted in one branch but edited in the other.