From 58853ccb1fa4d9834f55ef4116b71e8cdc88f46c Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Sun, 19 May 2024 05:11:12 +0100 Subject: [PATCH] Fix the label-on-approval workflow (#6136) --- .../add-label-run-extended-tests-approve.yml | 24 -------------- .github/workflows/after-approval.yml | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+), 24 deletions(-) delete mode 100644 .github/workflows/add-label-run-extended-tests-approve.yml create mode 100644 .github/workflows/after-approval.yml diff --git a/.github/workflows/add-label-run-extended-tests-approve.yml b/.github/workflows/add-label-run-extended-tests-approve.yml deleted file mode 100644 index c571ced211e..00000000000 --- a/.github/workflows/add-label-run-extended-tests-approve.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Add Label to run extended tests on approve - -on: - pull_request_review: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - label_pull_requests: - if: github.event.review.state == 'approved' && !contains( github.event.pull_request.labels.*.name, 'extended-tests') - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - run: gh pr edit "$NUMBER" --add-label "extended-tests" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_REPO: ${{ github.repository }} - NUMBER: ${{ github.event.pull_request.number }} - e2e-tests: - needs: label_pull_requests - uses: ./.github/workflows/call-e2e-all-tests.yml diff --git a/.github/workflows/after-approval.yml b/.github/workflows/after-approval.yml new file mode 100644 index 00000000000..75f494a6388 --- /dev/null +++ b/.github/workflows/after-approval.yml @@ -0,0 +1,32 @@ +name: After Approval + +on: + pull_request_review: + types: [submitted] + pull_request_target: + types: [review_requested, opened, reopened, synchronize] + branches: + - 'main' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + label-pr: + if: github.event.review.state == 'approved' && !contains(github.event.pull_request.labels.*.name, 'extended-tests') + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Add label for extended tests + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.pull_request.number }} + run: | + echo "Adding label 'extended-tests' to PR $NUMBER" + gh pr edit "$NUMBER" --add-label "extended-tests" || (echo "Failed to add label" && exit 1) + e2e-tests: + needs: label-pr + uses: ./.github/workflows/call-e2e-all-tests.yml