You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "kou (via GitHub)" <gi...@apache.org> on 2023/06/22 14:15:08 UTC
[GitHub] [arrow] kou commented on a diff in pull request #36244: GH-36243: [Dev] Remove PR workflow label as part of merge
kou commented on code in PR #36244:
URL: https://github.com/apache/arrow/pull/36244#discussion_r1238596542
##########
dev/merge_arrow_pr.py:
##########
@@ -421,8 +421,19 @@ def merge_pr(self, number, commit_title, commit_message):
if response.status_code != 200 and 'merged' not in result:
result['merged'] = False
result['message'] += f': {url}'
+ else:
+ self.clear_pr_state_labels(number)
return result
+ def clear_pr_state_labels(self, number):
+ url = f'{self.github_api}/issues/{number}/labels'
+ response = requests.get(url, headers=self.headers)
+ labels = response.json()
+ for label in labels:
+ if label['name'].startswith('awaiting'):
+ label_url = f"{url}/{label['name']}"
+ response = requests.delete(label_url, headers=self.headers)
Review Comment:
```suggestion
requests.delete(label_url, headers=self.headers)
```
##########
dev/merge_arrow_pr.py:
##########
@@ -421,8 +421,19 @@ def merge_pr(self, number, commit_title, commit_message):
if response.status_code != 200 and 'merged' not in result:
result['merged'] = False
result['message'] += f': {url}'
+ else:
+ self.clear_pr_state_labels(number)
Review Comment:
How about invert the condition for easy to read?
```suggestion
if response.status_code == 200 or 'merged' in result:
self.clear_pr_state_labels(number)
else:
result['merged'] = False
result['message'] += f': {url}'
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org