Skip to content

Commit

Permalink
feat: cleanup remote after use
Browse files Browse the repository at this point in the history
  • Loading branch information
wei committed Aug 15, 2019
1 parent e91139e commit 1d08364
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions github-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ echo "BRANCHES=$BRANCH_MAPPING"

# Github actions no longer auto set the username and GITHUB_TOKEN
git remote set-url origin "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY"
git remote add upstream "$UPSTREAM_REPO"
git fetch upstream
git remote add tmp_upstream "$UPSTREAM_REPO"
git fetch tmp_upstream
git remote -v
git push origin "refs/remotes/tmp_upstream/${BRANCH_MAPPING%%:*}:refs/heads/${BRANCH_MAPPING#*:}" -f
git remote rm tmp_upstream
git remote -v
git push origin "refs/remotes/upstream/${BRANCH_MAPPING%%:*}:refs/heads/${BRANCH_MAPPING#*:}" -f

0 comments on commit 1d08364

Please sign in to comment.