From 1dfa419c44c64ff382a136668156ae05658b32f6 Mon Sep 17 00:00:00 2001 From: Dusan Figala Date: Tue, 7 Mar 2023 11:21:01 +0100 Subject: [PATCH] Trigger CI when public PR is approved --- .github/workflows/ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5577e8d4d..99f2ffff4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,15 +10,20 @@ on: - '**' # Trigger the workflow on pull request - pull_request_target: ~ + pull_request: ~ # Trigger the workflow manually workflow_dispatch: ~ + # Trigger after public PR approved for CI + pull_request_target: + types: [labeled] + jobs: # Run CI including downstream packages on self-hosted runners downstream-ci: name: downstream-ci + if: ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }} uses: ecmwf-actions/downstream-ci/.github/workflows/downstream-ci.yml@main with: eccodes: ecmwf/eccodes@${{ github.event.pull_request.head.sha || github.sha }} @@ -28,7 +33,7 @@ jobs: private-downstream-ci: name: private-downstream-ci needs: [downstream-ci] - if: success() || failure() + if: (success() || failure()) && ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }} runs-on: ubuntu-latest permissions: pull-requests: write @@ -45,6 +50,7 @@ jobs: # Build downstream packages on HPC downstream-ci-hpc: name: downstream-ci-hpc + if: ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }} uses: ecmwf-actions/downstream-ci/.github/workflows/downstream-ci-hpc.yml@main with: eccodes: ecmwf/eccodes@${{ github.event.pull_request.head.sha || github.sha }} @@ -54,7 +60,7 @@ jobs: private-downstream-ci-hpc: name: private-downstream-ci-hpc needs: [downstream-ci-hpc] - if: success() || failure() + if: (success() || failure()) && ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }} runs-on: ubuntu-latest permissions: pull-requests: write