Skip to content

Commit 80d2e79

Browse files
committed
murdock/murdock.py: handle priority label changes
1 parent b4cddb8 commit 80d2e79

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

murdock/murdock.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,16 @@ async def handle_pull_request_event(self, event: dict):
439439
return
440440

441441
if action == "labeled":
442-
if event["label"]["name"] != CI_CONFIG.ready_label:
443-
return
444-
# Skip already queued jobs
445-
if event["label"][
446-
"name"
447-
] == CI_CONFIG.ready_label and self.queued.search_by_pr_number(
448-
pull_request.number
449-
):
442+
# return if the ready label was set for an already queued job,
443+
# or if the label wouldn't change the job's priority (and thus
444+
# queue position).
445+
# otherwise, fall through to re-scheduling the job.
446+
label_name = event["label"]["name"]
447+
if label_name == CI_CONFIG.ready_label:
448+
# Skip already queued jobs for ready label
449+
if self.queued.search_by_pr_number(pull_request.number):
450+
return
451+
elif label_name not in config.priorities.labels.keys():
450452
return
451453

452454
await self.schedule_job(job)

0 commit comments

Comments
 (0)