Skip to content

Commit

Permalink
Run hpc-ci on PRs filed from forks (#61)
Browse files Browse the repository at this point in the history
* Enable HPC-CI to be run on PRs filed from forks
  • Loading branch information
awnawab authored Feb 6, 2025
1 parent 2e150ba commit 79299b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/build-hpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/label-public-pr.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 79299b6

Please sign in to comment.