chore: only fetch the branch to be merged

This commit is contained in:
Tim Man
2024-04-03 13:58:35 +08:00
parent be1fe66daf
commit a6a40a8fc3

View File

@@ -32,7 +32,8 @@ git remote -v | grep -w $REMOTE_NAME || git remote add $REMOTE_NAME $REMOTE_URL
git remote set-url $REMOTE_NAME $REMOTE_URL
## fetch from all remotes including tags
git fetch --all --tags || true # TODO remove || true after fixing tag conflicts
git fetch $ORIGIN_NAME $ORIGIN_BRANCH --tags || true # TODO remove || true after fixing tag conflicts
git fetch $REMOTE_NAME $ORIGIN_BRANCH --tags || true # TODO remove || true after fixing tag conflicts
PR_TITLE="merge-$ORIGIN_BRANCH-to-$REMOTE_NAME"
REMOTE_BRANCH="chore/$PR_TITLE-$(date +%s)"
@@ -62,13 +63,5 @@ gh api \
-f base="$REMOTE_BASE" \
-f body="Created by merge-to-remote.sh" > pr.json
PULL_NUMBER=$(jq -r '.number' pr.json)
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/{owner}/$REMOTE_REPO/pulls/$PULL_NUMBER/requested_reviewers \
-f "team_reviewers[]=reviewers-web-extension"
## push tags
git push $REMOTE_NAME --tags || true # TODO remove || true after fixing tag conflicts