@@ -55,16 +55,16 @@ async def _remove_backport_label(gh, original_issue, branch, backport_pr_number)
5555async def manage_labels (gh , * args , ** kwargs ):
5656 with open (os .environ ["GITHUB_EVENT_PATH" ]) as f :
5757 event = json .load (f )
58- if event .get ("action" ) == "edited" and "title" not in event .get ("changes" ):
59- return
60- pull_request = event ["pull_request" ]
61- title = util .normalize_title (pull_request ['title' ],
62- pull_request ['body' ])
63- title_match = TITLE_RE .match (title )
64- if title_match is None :
65- return
66- branch = title_match .group ('branch' )
67- original_pr_number = title_match .group ('pr' )
58+ if event .get ("action" ) == "edited" and "title" not in event .get ("changes" ):
59+ return
60+ pull_request = event ["pull_request" ]
61+ title = util .normalize_title (pull_request ['title' ],
62+ pull_request ['body' ])
63+ title_match = TITLE_RE .match (title )
64+ if title_match is None :
65+ return
66+ branch = title_match .group ('branch' )
67+ original_pr_number = title_match .group ('pr' )
6868
6969 original_issue = await gh .getitem (event ['repository' ]['issues_url' ],
7070 {'number' : original_pr_number })
@@ -84,26 +84,26 @@ async def validate_maintenance_branch_pr(gh, *args, **kwargs):
8484 """
8585 with open (os .environ ["GITHUB_EVENT_PATH" ]) as f :
8686 event = json .load (f )
87- if event .get ("action" ) == "edited" and "title" not in event .get ("changes" ):
88- return
89- pull_request = event ["pull_request" ]
90- base_branch = pull_request ["base" ]["ref" ]
91-
92- if base_branch == "main" :
93- return
94-
95- title = util .normalize_title (pull_request ["title" ],
96- pull_request ["body" ])
97- title_match = MAINTENANCE_BRANCH_TITLE_RE .match (title )
98-
99- if title_match is None :
100- status = create_status (util .StatusState .FAILURE ,
101- description = "Not a valid maintenance branch PR title." ,
102- target_url = BACKPORT_TITLE_DEVGUIDE_URL )
103- else :
104- status = create_status (util .StatusState .SUCCESS ,
105- description = "Valid maintenance branch PR title." )
106- await util .post_status (gh , event , status )
87+ if event .get ("action" ) == "edited" and "title" not in event .get ("changes" ):
88+ return
89+ pull_request = event ["pull_request" ]
90+ base_branch = pull_request ["base" ]["ref" ]
91+
92+ if base_branch == "main" :
93+ return
94+
95+ title = util .normalize_title (pull_request ["title" ],
96+ pull_request ["body" ])
97+ title_match = MAINTENANCE_BRANCH_TITLE_RE .match (title )
98+
99+ if title_match is None :
100+ status = create_status (util .StatusState .FAILURE ,
101+ description = "Not a valid maintenance branch PR title." ,
102+ target_url = BACKPORT_TITLE_DEVGUIDE_URL )
103+ else :
104+ status = create_status (util .StatusState .SUCCESS ,
105+ description = "Valid maintenance branch PR title." )
106+ await util .post_status (gh , event , status )
107107
108108async def maintenance_branch_created (gh , * args , ** kwargs ):
109109 """Create the `needs backport label` when the maintenance branch is created.
0 commit comments