9 Codebuild Runs this script to check for branches with
10 same names accross downstream 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 = [
"ufo",
"saber",
"ioda",
"soca",
"fv3-jedi",
"mpas-jedi",
"shallow-water"]
29 token = os.getenv(
'GIT_PASS',
'...')
33 oopsRepo = g.get_repo(
"jcsda/oops")
35 for repoName
in repoList:
37 repo = g.get_repo(f
"{owner}/{repoName}")
38 branchList = list(repo.get_branches())
40 repo.get_branch(branchName)
46 print(branchName +
' exists in '+repoName)
47 stageDescription= branchName+
" exists in "+ repoName
48 commitStatus = oopsRepo.get_commit(sha=commitId).create_status(
50 description=stageDescription,
51 context=
"Branch Check-"+repoName)
53 print(branchName +
' does not exist in '+repoName)