Skip to content

Commit 93506d8

Browse files
committed
[no ci] Use *-ref defaults from checked-out build-ci workflow
1 parent 880b38d commit 93506d8

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ jobs:
3131
name: Setup CI
3232
runs-on: ubuntu-latest
3333
env:
34-
# These defaults can be overridden by the inputs (if the trigger is a workflow_dispatch)
35-
OVERRIDE_SPACK_REF: 'releases/v1.1'
36-
OVERRIDE_SPACK_CONFIG_REF: 'main'
37-
OVERRIDE_ACCESS_SPACK_PACKAGES_REF: ${{ github.event.pull_request.head.sha }}
34+
# Note, this needs to be updated in line with refs in the ci job below
35+
BUILD_CI_WORKFLOW_VERSION: v3
3836
PACKAGES_ROOT_DIR: spack_repo/access/nri/packages
3937
outputs:
4038
matrix: ${{ steps.set-matrix.outputs.matrix }}
@@ -125,13 +123,32 @@ jobs:
125123
# Remove the trailing comma and wrap in square brackets
126124
echo "matrix=[${json_entries%,}]" >> $GITHUB_OUTPUT
127125
126+
- name: Checkout build-ci
127+
uses: actions/checkout@v4
128+
with:
129+
repository: access-nri/build-ci
130+
ref: ${{ env.BUILD_CI_WORKFLOW_VERSION }}
131+
132+
- name: Get default refs from build-ci workflow
133+
id: defaults
134+
# GitHub does not treat empty-string inputs as eligible for substitution with a default
135+
# Since we are supporting both workflow_dispatch and pull_request triggers, the entrypoint inputs need to be filled in
136+
# So we are getting the default values from the workflow file itself, and passing them back into the workflow
137+
# builtin-spack-packages-ref does not need this as the input handles the empty string default.
138+
run: |
139+
default_spack_ref=$(yq '.on.workflow_call.inputs."spack-ref".default' .github/build-ci/workflows/ci.yml)
140+
spack_config_ref=$(yq '.on.workflow_call.inputs."spack-config-ref".default' .github/build-ci/workflows/ci.yml)
141+
142+
echo "Default refs from ${{ env.BUILD_CI_WORKFLOW_VERSION }}: spack-ref=$default_spack_ref, spack-config=$spack_config_ref"
143+
144+
128145
- name: Set refs
129146
id: set-refs
130147
run: |
131148
echo "builtin-spack-packages-ref=${{ inputs.builtin-spack-packages-ref }}" >> $GITHUB_OUTPUT
132-
echo "access-spack-packages-ref=${{ inputs.access-spack-packages-ref || env.OVERRIDE_ACCESS_SPACK_PACKAGES_REF }}" >> $GITHUB_OUTPUT
133-
echo "spack-config-ref=${{ inputs.spack-config-ref || env.OVERRIDE_SPACK_CONFIG_REF }}" >> $GITHUB_OUTPUT
134-
echo "spack-ref=${{ inputs.spack-ref || env.OVERRIDE_SPACK_REF }}" >> $GITHUB_OUTPUT
149+
echo "access-spack-packages-ref=${{ inputs.access-spack-packages-ref || github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
150+
echo "spack-config-ref=${{ inputs.spack-config-ref || steps.defaults.outputs.spack-config-ref }}" >> $GITHUB_OUTPUT
151+
echo "spack-ref=${{ inputs.spack-ref || steps.defaults.outputs.spack-ref }}" >> $GITHUB_OUTPUT
135152
136153
ci:
137154
name: CI

0 commit comments

Comments
 (0)