github: run actions with secrets only in seL4 org

Some of the Github actions in this repository require secrets for
access to hardware test or other compute infrastructure, or for
deployment. When these are run in a fork on GitHub they are safe,
but generate annoying error messages.

This commit adds tests in the relevant actions whether they are run
from the seL4 org or not, and skips the action when they are run
outside. This should make the remaining actions more useful on forks.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
This commit is contained in:
Gerwin Klein 2021-10-17 15:27:32 +11:00 committed by Gerwin Klein
parent 85bf4bb280
commit e5791a76cb
5 changed files with 16 additions and 10 deletions

View file

@ -40,6 +40,7 @@ jobs:
deploy:
name: Deploy manifest
needs: [code, preprocess]
if: ${{ github.repository_owner == 'seL4' }}
runs-on: ubuntu-latest
steps:
- uses: seL4/ci-actions/l4v-deploy@master

View file

@ -14,9 +14,10 @@ jobs:
runs-on: ubuntu-latest
# run on any normal trigger when the label exists, and run when the label is added
# don't run again when other labels are added
if: ${{ github.event.action != 'labeled' &&
if: ${{ github.repository_owner == 'seL4' &&
(github.event.action != 'labeled' &&
contains(github.event.pull_request.labels.*.name, 'proof-test') ||
github.event.action == 'labeled' && github.event.label.name == 'proof-test' }}
github.event.action == 'labeled' && github.event.label.name == 'proof-test') }}
strategy:
fail-fast: false
matrix:

View file

@ -78,6 +78,7 @@ jobs:
hw-run:
name: HW Run
if: ${{ github.repository_owner == 'seL4' }}
runs-on: ubuntu-latest
needs: [sim, hw-build]
strategy:
@ -140,6 +141,7 @@ jobs:
deploy:
name: Deploy manifest
if: ${{ github.repository_owner == 'seL4' }}
runs-on: ubuntu-latest
needs: [code, hw-run]
steps:

View file

@ -55,13 +55,14 @@ jobs:
name: HW Run
runs-on: ubuntu-latest
needs: hw-build
if: ${{ github.event_name == 'push' ||
if: ${{ github.repository_owner == 'seL4' &&
(github.event_name == 'push' ||
github.event_name == 'pull_request_target' &&
github.event.action != 'labeled' &&
contains(github.event.pull_request.labels.*.name, 'hw-test') ||
github.event_name == 'pull_request_target' &&
github.event.action == 'labeled' &&
github.event.label.name == 'hw-test' }}
github.event.label.name == 'hw-test') }}
strategy:
fail-fast: false
matrix:

View file

@ -12,6 +12,7 @@ on:
jobs:
trigger:
name: Repository Dispatch
if: ${{ github.repository_owner == 'seL4' }}
runs-on: ubuntu-latest
steps:
- uses: seL4/ci-actions/trigger@master