|
| 1 | +name: Trigger clas12-systems tests |
| 2 | + |
| 3 | +run-name: Triggered by successful deploy workflow |
| 4 | + |
| 5 | +# Fires a workflow_dispatch on gemc/clas12-systems' Test workflow whenever the |
| 6 | +# gemc/src Deploy workflow succeeds on a push to main, i.e. after fresh |
| 7 | +# ghcr.io/gemc/src images (which clas12-systems' tests run inside) are published. |
| 8 | +# Requires a repository secret named CLAS12_SYSTEMS_PAT holding a GitHub Personal |
| 9 | +# Access Token with the `workflow` scope granted on the gemc/clas12-systems repo |
| 10 | +# (mirrors pygemc's GEMC_SRC_PAT, pointing the other way). |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: gemc-trigger-clas12-systems-${{ github.event.workflow_run.id }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +on: |
| 20 | + workflow_run: |
| 21 | + workflows: [ "Deploy" ] |
| 22 | + types: [ completed ] |
| 23 | + |
| 24 | +jobs: |
| 25 | + dispatch: |
| 26 | + name: Dispatch clas12-systems Test |
| 27 | + # Security: only dispatch for a successful push to the base repo. workflow_run |
| 28 | + # runs privileged (here it consumes CLAS12_SYSTEMS_PAT), so guard against |
| 29 | + # fork-PR events the same way deploy.yml and binary_tarballs.yml do. |
| 30 | + if: >- |
| 31 | + ${{ |
| 32 | + github.event.workflow_run.conclusion == 'success' && |
| 33 | + github.event.workflow_run.event == 'push' |
| 34 | + }} |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - name: Trigger workflow_dispatch on gemc/clas12-systems |
| 38 | + run: | |
| 39 | + curl --fail-with-body -X POST \ |
| 40 | + -H "Accept: application/vnd.github+json" \ |
| 41 | + -H "Authorization: Bearer ${{ secrets.CLAS12_SYSTEMS_PAT }}" \ |
| 42 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 43 | + https://api.github.com/repos/gemc/clas12-systems/actions/workflows/test.yml/dispatches \ |
| 44 | + -d '{"ref":"main","inputs":{"triggered_by":"gemc/src deploy"}}' |
0 commit comments