From 04598d8ed3b52d1f0de069fade357dd9d40d8685 Mon Sep 17 00:00:00 2001 From: Michal Nowikowski <113998718+michaln-gc@users.noreply.github.com> Date: Fri, 9 Jun 2023 09:34:23 +0200 Subject: [PATCH] ci: fix syncing all branches (#61) --- .github/workflows/sync-repos.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-repos.yml b/.github/workflows/sync-repos.yml index 9a2d1f1..dd0cb7c 100644 --- a/.github/workflows/sync-repos.yml +++ b/.github/workflows/sync-repos.yml @@ -23,9 +23,15 @@ jobs: env: DEST_REPO_URL: https://${{ secrets.GH_TOKEN_USER }}:${{ secrets.GH_TOKEN_SYNC_REPOS }}@github.com/graphcore/Gradient-HuggingFace run: | - git remote add target "${DEST_REPO_URL}" + # checkout all remote branches + git checkout main + for BRANCH in $(git branch -a | grep remotes | grep -v HEAD | grep -v main); do + git branch --force --track "${BRANCH#remotes/origin/}" "${BRANCH}" + done # remove pull refs that are for Pull Requests, GitHub does not accept them git for-each-ref --format 'delete %(refname)' refs/pull | git update-ref --stdin + git remote add target "${DEST_REPO_URL}" + git push --mirror target