Skip to content

Commit 79299b6

Browse files
authored
Run hpc-ci on PRs filed from forks (#61)
* Enable HPC-CI to be run on PRs filed from forks
1 parent 2e150ba commit 79299b6

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

.github/workflows/build-hpc.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
# Allow workflow to be dispatched on demand
1010
workflow_dispatch: ~
1111

12+
# Trigger after public PR approved for CI
13+
pull_request_target:
14+
types: [labeled]
15+
1216
env:
1317
ECWAM_TOOLS: ${{ github.workspace }}/.github/tools
1418
CTEST_PARALLEL_LEVEL: 1
@@ -17,6 +21,7 @@ env:
1721
jobs:
1822
ci-hpc:
1923
name: ci-hpc
24+
if: ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }}
2025

2126
strategy:
2227
fail-fast: false # false: try to complete all jobs
@@ -119,15 +124,17 @@ jobs:
119124
popd
120125
{% endfor %}
121126
122-
mkdir -p ${{ github.repository }}
123-
pushd ${{ github.repository }}
127+
REPO=${{ github.event.pull_request.head.repo.full_name || github.repository }}
128+
SHA=${{ github.event.pull_request.head.sha || github.sha }}
129+
mkdir -p $REPO
130+
pushd $REPO
124131
git init
125-
git remote add origin ${{ github.server_url }}/${{ github.repository }}
126-
git fetch origin ${{ github.sha }}
132+
git remote add origin ${{ github.server_url }}/$REPO
133+
git fetch origin $SHA
127134
git reset --hard FETCH_HEAD
128135
popd
129136
130-
cmake -G Ninja -S ${{ github.repository }} -B build \
137+
cmake -G Ninja -S $REPO -B build \
131138
{% for name in dependencies %}
132139
{% set org, proj = name.split('/') %}
133140
-D{{proj}}_ROOT=$BASEDIR/{{name}}/installation \

.github/workflows/label-public-pr.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Manage labels of pull requests that originate from forks
2+
name: label-public-pr
3+
4+
on:
5+
pull_request_target:
6+
types: [opened, synchronize]
7+
8+
jobs:
9+
label:
10+
uses: ecmwf-actions/reusable-workflows/.github/workflows/label-pr.yml@v2
11+

0 commit comments

Comments
 (0)