diff --git a/Project.toml b/Project.toml index 7fce9ca7..09885808 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "RegistryCI" uuid = "0c95cc5f-2f7e-43fe-82dd-79dbcba86b32" authors = ["Dilum Aluthge ", "Fredrik Ekre ", "contributors"] -version = "10.8.0" +version = "10.8.1" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" diff --git a/src/AutoMerge/cron.jl b/src/AutoMerge/cron.jl index 926ad6cb..cb6b7ced 100644 --- a/src/AutoMerge/cron.jl +++ b/src/AutoMerge/cron.jl @@ -307,6 +307,34 @@ function cron_or_api_build( return nothing end + # We will check for blocked here, once we think it's a registration PR + # (as opposed to some other kind of PR). + # This way we can update the labels now, regardless of the current status + # of the other steps (e.g. automerge passing, waiting period, etc). + blocked = pr_has_blocking_comments(api, registry, pr; auth=auth) && !has_label(pr.labels, OVERRIDE_BLOCKS_LABEL) + if blocked + if !read_only + # add `BLOCKED_LABEL` to communicate to users + # that the PR is blocked from automerging + GitHub.add_labels(api, registry.full_name, pr_number, [BLOCKED_LABEL]; auth=auth) + end + @info( + string( + "Pull request: $(pr_number). ", + "Decision: do not merge. ", + "Reason: pull request has one or more blocking comments.", + ) + ) + return nothing + elseif has_label(pr.labels, BLOCKED_LABEL) && !read_only + # remove block label BLOCKED_LABEL if it exists + # note we use `try_remove_label` to avoid crashing the job + # if there is some race condition or manual intervention + # and the blocked label was removed at some point between + # when the `pr` object was created and now. + try_remove_label(api, registry.full_name, pr_number, BLOCKED_LABEL; auth=auth) + end + if is_new_package(pr) # it is a new package pr_type = :NewPackage pkg, version = parse_pull_request_title(NewPackage(), pr) @@ -394,31 +422,6 @@ function cron_or_api_build( return nothing end - blocked = pr_has_blocking_comments(api, registry, pr; auth=auth) && !has_label(pr.labels, OVERRIDE_BLOCKS_LABEL) - if blocked - if !read_only - # add `BLOCKED_LABEL` to communicate to users - # that the PR is blocked from automerging - GitHub.add_labels(api, registry.full_name, pr_number, [BLOCKED_LABEL]; auth=auth) - end - @info( - string( - "Pull request: $(pr_number). ", - "Type: $(pr_type). ", - "Decision: do not merge. ", - "Reason: pull request has one or more blocking comments.", - ) - ) - return nothing - elseif has_label(pr.labels, BLOCKED_LABEL) && !read_only - # remove block label BLOCKED_LABEL if it exists - # note we use `try_remove_label` to avoid crashing the job - # if there is some race condition or manual intervention - # and the blocked label was removed at some point between - # when the `pr` object was created and now. - try_remove_label(api, registry.full_name, pr_number, BLOCKED_LABEL; auth=auth) - end - if pr_type == :NewPackage # it is a new package always_assert(status_pr_type == :NewPackage) if merge_new_packages