1212# Legend:
1313# This script is used to migrate repos from one organization
1414# to a master organization. This is done in org consolidations.
15- # It will transfer ownership to the new org. It can be ran in debug
16- # mode to show what repos will be migrated. It can also set
15+ # It will transfer ownership to the new org. It can also set
1716# teams access in master org when the transfer is complete.
18- # You Just need to set the teams ids in the script
17+ # You just need to set the teams ids in the script
1918# To run the script:
2019#
21- # - Update vareiables section in script
20+ # - Update variables section in script
2221# - chmod +x script.sh
2322# - export GITHUB_TOKEN=YourGitHubTokenWithAccess
2423# - ./script.sh UsersOrg
@@ -35,10 +34,10 @@ DEBUG=1 # Debug Flag 0=execute 1=report
3534# #######
3635# VARS #
3736# #######
38- ORIG_ORG=$1 # Name of the users GitHub Organization
39- UPDATE_TEAMS=1 # UPdate Teams access 0=skip 1=execute
37+ ORIG_ORG=$1 # Name of the Original GitHub Organization
38+ UPDATE_TEAMS=1 # Update Teams access 0=skip 1=execute
4039MASTER_ORG=' ' # Name of the master Organization
41- GITHUB_TOKEN=' ' # Token to authenticate into GitHub
40+ # GITHUB_TOKEN='' # Token to authenticate into GitHub
4241GITHUB_URL=" https://api.github.com" # URL to GitHub
4342READ_TEAM=' ' # ID of the GitHub team with read access
4443WRITE_TEAM=' ' # Team to add with write access to the repos
@@ -129,7 +128,8 @@ GetTeamIds()
129128 # Get the team id
130129 get_team_id ()
131130 {
132- echo ${TEAM_RESPONSE} | base64 --decode --ignore-garbage | jq -r ${1}
131+ echo ${TEAM_RESPONSE} | base64 --decode | jq -r ${1}
132+ # echo ${TEAM_RESPONSE} | base64 --decode --ignore-garbage | jq -r ${1} # Need ignore garbae on windows machines
133133 }
134134
135135 # Get the id of the team
@@ -146,6 +146,7 @@ UpdateTeamPermission()
146146{
147147 # need to add the teams permissions to the repo
148148 REPO_TO_UPDATE_PERMS=$1
149+ # https://developer.github.com/v3/teams/#edit-team
149150 # PUT /teams/:team_id/repos/:owner/:repo
150151
151152 # ##################################
@@ -232,7 +233,8 @@ GetOrigOrgRepos()
232233 # Pull the name of the repo out
233234 get_orig_repo_name ()
234235 {
235- echo ${orig_repo} | base64 --decode --ignore-garbage | jq -r ${1}
236+ echo ${orig_repo} | base64 --decode | jq -r ${1}
237+ # echo ${orig_repo} | base64 --decode --ignore-garbage | jq -r ${1} # Need ignore garbage on windows machines
236238 }
237239
238240 # Get the name of the repo
@@ -355,7 +357,7 @@ Header()
355357 if [ $UPDATE_TEAMS -eq 1 ]; then
356358 echo " Updating Repositories teams when migrating"
357359 else
358- echo " No teams will be set during the migration process"
360+ echo " No teams will be assigned during the migration process"
359361 fi
360362 echo " "
361363}
0 commit comments