Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-36243: [Dev] Remove PR workflow label as part of merge #36244

Merged
merged 3 commits into from
Jun 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion dev/merge_arrow_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw based on the API if the result is 200 the merge was successful and merged will always be true.
https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#merge-a-pull-request
I am sure we can mark this as False if those are not successful.

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'):
raulcd marked this conversation as resolved.
Show resolved Hide resolved
label_url = f"{url}/{label['name']}"
requests.delete(label_url, headers=self.headers)


class CommandInput(object):
"""
Expand Down