diff --git a/.github/workflows/build-hpc.yml b/.github/workflows/build-hpc.yml index 721360d4..543ecf35 100644 --- a/.github/workflows/build-hpc.yml +++ b/.github/workflows/build-hpc.yml @@ -9,6 +9,10 @@ on: # Allow workflow to be dispatched on demand workflow_dispatch: ~ + # Trigger after public PR approved for CI + pull_request_target: + types: [labeled] + env: ECWAM_TOOLS: ${{ github.workspace }}/.github/tools CTEST_PARALLEL_LEVEL: 1 @@ -17,6 +21,7 @@ env: jobs: ci-hpc: name: ci-hpc + if: ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }} strategy: fail-fast: false # false: try to complete all jobs @@ -119,15 +124,17 @@ jobs: popd {% endfor %} - mkdir -p ${{ github.repository }} - pushd ${{ github.repository }} + REPO=${{ github.event.pull_request.head.repo.full_name || github.repository }} + SHA=${{ github.event.pull_request.head.sha || github.sha }} + mkdir -p $REPO + pushd $REPO git init - git remote add origin ${{ github.server_url }}/${{ github.repository }} - git fetch origin ${{ github.sha }} + git remote add origin ${{ github.server_url }}/$REPO + git fetch origin $SHA git reset --hard FETCH_HEAD popd - cmake -G Ninja -S ${{ github.repository }} -B build \ + cmake -G Ninja -S $REPO -B build \ {% for name in dependencies %} {% set org, proj = name.split('/') %} -D{{proj}}_ROOT=$BASEDIR/{{name}}/installation \ diff --git a/.github/workflows/label-public-pr.yml b/.github/workflows/label-public-pr.yml new file mode 100644 index 00000000..1027b04a --- /dev/null +++ b/.github/workflows/label-public-pr.yml @@ -0,0 +1,11 @@ +# Manage labels of pull requests that originate from forks +name: label-public-pr + +on: + pull_request_target: + types: [opened, synchronize] + +jobs: + label: + uses: ecmwf-actions/reusable-workflows/.github/workflows/label-pr.yml@v2 +