Fix the "CH Inc sync" job in a pull request by resolving conflicts in the corresponding clickhouse-private sync PR.
Fix the "CH Inc sync" CI job for a ClickHouse pull request by resolving merge conflicts in the corresponding clickhouse-private sync PR.
$0 (required): PR number or full GitHub URL of the public ClickHouse PR (e.g., 96005 or https://github.com/ClickHouse/ClickHouse/pull/96005)When a PR is opened in ClickHouse/ClickHouse, a sync PR is automatically created in ClickHouse/clickhouse-private on a branch named sync-upstream/pr/<PR_NUMBER>. If this sync PR has merge conflicts, the "CH Inc sync" check stays pending. This skill resolves those conflicts.
$ARGUMENTShttps://github.com/ClickHouse/ClickHouse/pull/96005), extract the number from the URLAskUserQuestion to ask for the PR numbergh pr list --repo ClickHouse/clickhouse-private --head sync-upstream/pr/<PR_NUMBER> --json number,url,state,mergeable,mergeStateStatus,headRefName
CONFLICTING), report that no action is needed and stopclickhouse-private repository in common locations relative to the current working directory:
../ClickHouse_private../clickhouse-privateClickHouse/clickhouse-private as a remoteAskUserQuestion to ask the user for the pathIn the private repository directory:
cd <private_repo_path> && git fetch origin && git fetch origin sync-upstream/pr/<PR_NUMBER>
Then check out the sync branch:
cd <private_repo_path> && git checkout sync-upstream/pr/<PR_NUMBER>
If the branch has local changes, ask the user before proceeding.
cd <private_repo_path> && git merge origin/master
This will likely produce conflicts. Handle them:
List conflicted files:
cd <private_repo_path> && git diff --name-only --diff-filter=U
For each conflicted file, use a Task agent with subagent_type=general-purpose to resolve:
<<<<<<<, =======, >>>>>>>)git add <file>IMPORTANT: If conflicts are complex or ambiguous, show the conflicts to the user and ask how to resolve them using AskUserQuestion.
After resolving all conflicts, complete the merge:
cd <private_repo_path> && git commit --no-edit
cd <private_repo_path> && git submodule update --init --recursive
If submodule update fails, report the error but continue.
Use AskUserQuestion to ask the user:
If the user chooses to build, use the build skill or run ninja directly.
cd <private_repo_path> && git push origin sync-upstream/pr/<PR_NUMBER>
After pushing:
gh pr view <SYNC_PR_NUMBER> --repo ClickHouse/clickhouse-private --json mergeable,mergeStateStatus
Report the result:
mergeable is MERGEABLE: "Sync PR is now mergeable. The CH Inc sync check should pass shortly."Provide the sync PR URL for the user to check.
/fix-sync 96005 - Fix sync for PR #96005/fix-sync https://github.com/ClickHouse/ClickHouse/pull/96005 - Fix sync using full URLsync-upstream/pr/<PR_NUMBER>