12
12
# Legend:
13
13
# This script is used to migrate repos from one organization
14
14
# 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
17
16
# 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
19
18
# To run the script:
20
19
#
21
- # - Update vareiables section in script
20
+ # - Update variables section in script
22
21
# - chmod +x script.sh
23
22
# - export GITHUB_TOKEN=YourGitHubTokenWithAccess
24
23
# - ./script.sh UsersOrg
@@ -35,10 +34,10 @@ DEBUG=1 # Debug Flag 0=execute 1=report
35
34
# #######
36
35
# VARS #
37
36
# #######
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
40
39
MASTER_ORG=' ' # Name of the master Organization
41
- GITHUB_TOKEN=' ' # Token to authenticate into GitHub
40
+ # GITHUB_TOKEN='' # Token to authenticate into GitHub
42
41
GITHUB_URL=" https://api.github.com" # URL to GitHub
43
42
READ_TEAM=' ' # ID of the GitHub team with read access
44
43
WRITE_TEAM=' ' # Team to add with write access to the repos
@@ -129,7 +128,8 @@ GetTeamIds()
129
128
# Get the team id
130
129
get_team_id ()
131
130
{
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
133
133
}
134
134
135
135
# Get the id of the team
@@ -146,6 +146,7 @@ UpdateTeamPermission()
146
146
{
147
147
# need to add the teams permissions to the repo
148
148
REPO_TO_UPDATE_PERMS=$1
149
+ # https://developer.github.com/v3/teams/#edit-team
149
150
# PUT /teams/:team_id/repos/:owner/:repo
150
151
151
152
# ##################################
@@ -232,7 +233,8 @@ GetOrigOrgRepos()
232
233
# Pull the name of the repo out
233
234
get_orig_repo_name ()
234
235
{
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
236
238
}
237
239
238
240
# Get the name of the repo
@@ -355,7 +357,7 @@ Header()
355
357
if [ $UPDATE_TEAMS -eq 1 ]; then
356
358
echo " Updating Repositories teams when migrating"
357
359
else
358
- echo " No teams will be set during the migration process"
360
+ echo " No teams will be assigned during the migration process"
359
361
fi
360
362
echo " "
361
363
}
0 commit comments