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

add 'retest' as a reason to --close-pr, to close/re-open PRs to trigger re-test in Travis #3040

Merged
merged 3 commits into from
Oct 12, 2019
Merged
Changes from 1 commit
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
25 changes: 18 additions & 7 deletions easybuild/tools/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
'archived': 'uses an archived toolchain',
'inactive': 'no activity for > 6 months',
'obsolete': 'obsoleted by more recent PRs',
'reopen': 'closing and reopening to trigger tests',
Copy link
Member

Choose a reason for hiding this comment

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

maybe name it retest instead?

}


Expand Down Expand Up @@ -668,7 +669,7 @@ def _easyconfigs_pr_common(paths, ecs, start_branch=None, pr_branch=None, start_
if paths['easyconfigs']:
for path in paths['easyconfigs']:
if not os.path.exists(path):
non_existing_paths.append(path)
non_existing_paths.append(path)
else:
ec_paths.append(path)

Expand Down Expand Up @@ -1109,6 +1110,8 @@ def close_pr(pr, motivation_msg=None):

dry_run = build_option('dry_run') or build_option('extended_dry_run')

reopen = motivation_msg == VALID_CLOSE_PR_REASONS['reopen']

if not motivation_msg:
print_msg("No reason or message specified, looking for possible reasons\n")
possible_reasons = reasons_for_closing(pr_data)
Expand All @@ -1120,15 +1123,18 @@ def close_pr(pr, motivation_msg=None):
motivation_msg = ", ".join([VALID_CLOSE_PR_REASONS[reason] for reason in possible_reasons])
print_msg("\nNo reason specified but found possible reasons: %s.\n" % motivation_msg, prefix=False)

msg = "@%s, this PR is being closed for the following reason(s): %s.\n" % (pr_data['user']['login'], motivation_msg)
msg += "Please don't hesitate to reopen this PR or add a comment if you feel this contribution is still relevant.\n"
msg += "For more information on our policy w.r.t. closing PRs, see "
msg += "https://easybuild.readthedocs.io/en/latest/Contributing.html"
msg += "#why-a-pull-request-may-be-closed-by-a-maintainer"
msg = "@%s, this PR is being closed for the following reason(s): %s." % (pr_data['user']['login'], motivation_msg)
if not reopen:
msg += "\nPlease don't hesitate to reopen this PR or add a comment if you feel this contribution is still "
msg += "relevant.\nFor more information on our policy w.r.t. closing PRs, see "
msg += "https://easybuild.readthedocs.io/en/latest/Contributing.html"
msg += "#why-a-pull-request-may-be-closed-by-a-maintainer"
post_comment_in_issue(pr, msg, account=pr_target_account, repo=pr_target_repo, github_user=github_user)

if dry_run:
print_msg("[DRY RUN] Closed %s/%s pull request #%s" % (pr_target_account, pr_target_repo, pr), prefix=False)
print_msg("[DRY RUN] Closed %s/%s PR #%s" % (pr_target_account, pr_target_repo, pr), prefix=False)
if reopen:
print_msg("[DRY RUN] Reopened %s/%s PR #%s" % (pr_target_account, pr_target_repo, pr), prefix=False)
else:
github_token = fetch_github_token(github_user)
if github_token is None:
Expand All @@ -1139,6 +1145,11 @@ def close_pr(pr, motivation_msg=None):
status, data = pull_url.post(body=body)
if not status == HTTP_STATUS_OK:
raise EasyBuildError("Failed to close PR #%s; status %s, data: %s", pr, status, data)
if reopen:
body = {'state': 'open'}
status, data = pull_url.post(body=body)
if not status == HTTP_STATUS_OK:
raise EasyBuildError("Failed to reopen PR #%s; status %s, data: %s", pr, status, data)


def list_prs(params, per_page=GITHUB_MAX_PER_PAGE, github_user=None):
Expand Down