9 Codebuild Runs this script to check for branches with
10 same names accross dependent repos. Then creates a
11 webhook on PR page to notify users if such a branch exists.
14 update_webhook_branchname.py branchName commitId
19 from github
import Github
22 branchName = sys.argv[1]
23 commitId = sys.argv[2]
27 repoList = [
"atlas",
"oops",
"ioda",
"ufo",
"soca",
"fv3-jedi",
"mpas-jedi"]
29 token = os.getenv(
'GIT_PASS',
'...')
31 ownerList = [
"JCSDA",
"jcsda-internal"]
33 saberRepo = g.get_repo(
"jcsda/saber")
35 for owner
in ownerList:
36 for repoName
in repoList:
38 repo = g.get_repo(f
"{owner}/{repoName}")
39 branchList = list(repo.get_branches())
41 repo.get_branch(branchName)
47 print(branchName +
' exists in '+owner+
'/'+repoName)
48 stageDescription= branchName+
" exists in "+owner+
'/'+ repoName
49 commitStatus = saberRepo.get_commit(sha=commitId).create_status(
51 description=stageDescription,
52 context=
"Branch Check-"+owner+
'/'+repoName)
54 print(branchName +
' does not exist in '+owner+
'/'+repoName)