Skip to content

Commit 1ea947d

Browse files
authored
Merge pull request #3967 from branfosj/20220219114626_new_pr_IZhhHBLEEX
add a 'sync pr' message when the PR has a mergeable state but is showing a failed status for the test suite on the last commit
2 parents 0e33420 + 20fdb74 commit 1ea947d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

easybuild/tools/github.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,12 +1155,14 @@ def not_eligible(msg):
11551155

11561156
# check test suite result, Travis must give green light
11571157
msg_tmpl = "* test suite passes: %s"
1158+
failed_status_last_commit = False
11581159
if pr_data['status_last_commit'] == STATUS_SUCCESS:
11591160
print_msg(msg_tmpl % 'OK', prefix=False)
11601161
elif pr_data['status_last_commit'] == STATUS_PENDING:
11611162
res = not_eligible(msg_tmpl % "pending...")
11621163
else:
11631164
res = not_eligible(msg_tmpl % "(status: %s)" % pr_data['status_last_commit'])
1165+
failed_status_last_commit = True
11641166

11651167
if pr_data['base']['repo']['name'] == GITHUB_EASYCONFIGS_REPO:
11661168
# check for successful test report (checked in reverse order)
@@ -1221,14 +1223,20 @@ def not_eligible(msg):
12211223

12221224
# check github mergeable state
12231225
msg_tmpl = "* mergeable state is clean: %s"
1226+
mergeable = False
12241227
if pr_data['merged']:
12251228
print_msg(msg_tmpl % "PR is already merged", prefix=False)
12261229
elif pr_data['mergeable_state'] == GITHUB_MERGEABLE_STATE_CLEAN:
12271230
print_msg(msg_tmpl % "OK", prefix=False)
1231+
mergeable = True
12281232
else:
12291233
reason = "FAILED (mergeable state is '%s')" % pr_data['mergeable_state']
12301234
res = not_eligible(msg_tmpl % reason)
12311235

1236+
if failed_status_last_commit and mergeable:
1237+
print_msg("\nThis PR is mergeable but the test suite has a failed status. Try syncing the PR with the "
1238+
"develop branch using 'eb --sync-pr-with-develop %s'" % pr_data['number'], prefix=False)
1239+
12321240
return res
12331241

12341242

0 commit comments

Comments
 (0)