diff --git a/dev/merge_arrow_pr.py b/dev/merge_arrow_pr.py index 352befc3289c2..90b2e9b034eea 100755 --- a/dev/merge_arrow_pr.py +++ b/dev/merge_arrow_pr.py @@ -418,11 +418,23 @@ def merge_pr(self, number, commit_title, commit_message): } response = requests.put(url, headers=self.headers, json=payload) result = response.json() - if response.status_code != 200 and 'merged' not in result: + if response.status_code == 200 and 'merged' in result: + self.clear_pr_state_labels(number) + else: result['merged'] = False result['message'] += f': {url}' 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: + # All PR workflow state labes starts with "awaiting" + if label['name'].startswith('awaiting'): + label_url = f"{url}/{label['name']}" + requests.delete(label_url, headers=self.headers) + class CommandInput(object): """