Created
March 11, 2021 06:37
-
-
Save zhouqiang-cl/214cb68d2d1dcf80aab5adbf479e9459 to your computer and use it in GitHub Desktop.
create branch in multi repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First your should have $TOKEN | |
base_branch=master | |
new_branch=release-5.0 | |
repo_list="zhouqiang-cl/charts zhouqiang-cl/research" | |
set -x | |
for repo in $repo_list;do | |
sha=$(curl -H "Authorization: token $TOKEN" https://api.github.com/repos/$repo/git/refs/heads/$base_branch | jq -r '.object.sha') | |
curl -X POST -H "Authorization: token $TOKEN" \ | |
-d "{\"ref\": \"refs/heads/$new_branch\",\"sha\": \"$sha\"}" "https://api.github.com/repos/$repo/git/refs" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment