From 0e7ff339de62e2a6bf7aea6adc88494d61ee4538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Mon, 28 Oct 2024 17:05:02 +0100 Subject: [PATCH 1/6] gh-126081: For PRs labeled with "type-feature", require a core review --- .github/workflows/require-pr-label.yml | 44 ++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/.github/workflows/require-pr-label.yml b/.github/workflows/require-pr-label.yml index ff5cbdf3eda749..bbbe67b9e1910e 100644 --- a/.github/workflows/require-pr-label.yml +++ b/.github/workflows/require-pr-label.yml @@ -9,15 +9,53 @@ permissions: pull-requests: write jobs: - label: + label-dnm: + name: DO-NOT-MERGE + if: github.repository_owner == 'python' + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Check there's no DO-NOT-MERGE + uses: mheap/github-action-required-labels@v5 + with: + mode: exactly + count: 0 + labels: | + DO-NOT-MERGE + label-reviews: name: DO-NOT-MERGE / unresolved review if: github.repository_owner == 'python' runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: mheap/github-action-required-labels@v5 + - name: Check there's no required changes + uses: mheap/github-action-required-labels@v5 with: mode: exactly count: 0 - labels: "DO-NOT-MERGE, awaiting changes, awaiting change review" + labels: | + awaiting changes + awaiting change review + - id: is-feature + name: Check for type-feature label + uses: mheap/github-action-required-labels@v5 + with: + mode: exactly + count: 1 + labels: | + type-feature + exit_type: success + - id: awaiting-merge + name: Check for complete review + uses: mheap/github-action-required-labels@v5 + with: + mode: exactly + count: 1 + labels: | + awaiting merge + exit_type: success + - name: Don't accept feature PRs with no review + if: steps.is-feature.outputs.status == 'success' && steps.awaiting-merge.outputs.status == 'failure' + run: exit 1 From 01b2241ef3c95ed50606bd1dba7a9f77eb033ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Mon, 28 Oct 2024 17:08:17 +0100 Subject: [PATCH 2/6] Better job name --- .github/workflows/require-pr-label.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/require-pr-label.yml b/.github/workflows/require-pr-label.yml index bbbe67b9e1910e..27dcc76f323668 100644 --- a/.github/workflows/require-pr-label.yml +++ b/.github/workflows/require-pr-label.yml @@ -24,7 +24,7 @@ jobs: labels: | DO-NOT-MERGE label-reviews: - name: DO-NOT-MERGE / unresolved review + name: Unresolved review if: github.repository_owner == 'python' runs-on: ubuntu-latest timeout-minutes: 10 From 5e47375de4872277f0f494ab8630891024653c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Mon, 28 Oct 2024 17:15:42 +0100 Subject: [PATCH 3/6] Further reword --- .github/workflows/require-pr-label.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/require-pr-label.yml b/.github/workflows/require-pr-label.yml index 27dcc76f323668..d7c2d18bf00f35 100644 --- a/.github/workflows/require-pr-label.yml +++ b/.github/workflows/require-pr-label.yml @@ -39,7 +39,7 @@ jobs: awaiting changes awaiting change review - id: is-feature - name: Check for type-feature label + name: Check for type-feature uses: mheap/github-action-required-labels@v5 with: mode: exactly From f2af9085f445e8bf62086434823c4c502cadaad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Mon, 28 Oct 2024 17:19:14 +0100 Subject: [PATCH 4/6] Simplify logic --- .github/workflows/require-pr-label.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/require-pr-label.yml b/.github/workflows/require-pr-label.yml index d7c2d18bf00f35..3c94b6acd97fde 100644 --- a/.github/workflows/require-pr-label.yml +++ b/.github/workflows/require-pr-label.yml @@ -48,6 +48,7 @@ jobs: type-feature exit_type: success - id: awaiting-merge + if: steps.is-feature.outputs.status == 'success' name: Check for complete review uses: mheap/github-action-required-labels@v5 with: @@ -55,7 +56,3 @@ jobs: count: 1 labels: | awaiting merge - exit_type: success - - name: Don't accept feature PRs with no review - if: steps.is-feature.outputs.status == 'success' && steps.awaiting-merge.outputs.status == 'failure' - run: exit 1 From cb4375476c92b1ff0fce7b43d46747f6083ea508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Mon, 28 Oct 2024 17:47:21 +0100 Subject: [PATCH 5/6] Add inline comments Ezio wanted --- .github/workflows/require-pr-label.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/require-pr-label.yml b/.github/workflows/require-pr-label.yml index 3c94b6acd97fde..6adcd93d9cf9e0 100644 --- a/.github/workflows/require-pr-label.yml +++ b/.github/workflows/require-pr-label.yml @@ -30,6 +30,7 @@ jobs: timeout-minutes: 10 steps: + # Check that the PR is not awaiting changes from the author due to previous review. - name: Check there's no required changes uses: mheap/github-action-required-labels@v5 with: @@ -39,14 +40,15 @@ jobs: awaiting changes awaiting change review - id: is-feature - name: Check for type-feature + name: Check whether this PR is a feature (contains a "type-feature" label) uses: mheap/github-action-required-labels@v5 with: mode: exactly count: 1 labels: | type-feature - exit_type: success + exit_type: success # don't fail the check if the PR is not a feature, just record the result + # In case of a feature PR, check for a complete review (contains an "awaiting merge" label). - id: awaiting-merge if: steps.is-feature.outputs.status == 'success' name: Check for complete review From 814fc5f9a54aa5a915a0bf5cf43401fae2452ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Mon, 28 Oct 2024 17:48:59 +0100 Subject: [PATCH 6/6] Restore empty line --- .github/workflows/require-pr-label.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/require-pr-label.yml b/.github/workflows/require-pr-label.yml index 6adcd93d9cf9e0..bbedd22cc6d189 100644 --- a/.github/workflows/require-pr-label.yml +++ b/.github/workflows/require-pr-label.yml @@ -23,6 +23,7 @@ jobs: count: 0 labels: | DO-NOT-MERGE + label-reviews: name: Unresolved review if: github.repository_owner == 'python'