Skip to content

Commit ab80361

Browse files
authored
Make dynamic defaults work manually (#57)
* ci.yml: Defaults root-sbd input to model manually * ci.yml: Redirected github step output
1 parent 12d2743 commit ab80361

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/ci.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
root-sbd:
1515
type: string
1616
required: false
17-
default: ${{ inputs.model }}
17+
# default: The ${{ inputs.model }} above
1818
description: |
1919
The name of the root Spack Bundle Definition, if it is different from the model name.
2020
This is often a package named similarly in ACCESS-NRI/spack-packages.
@@ -67,6 +67,16 @@ jobs:
6767
with:
6868
fetch-depth: 0
6969

70+
- name: Set root-sbd Default
71+
id: default
72+
# Unfortunately, you can't set a dynamic default value based on `inputs` yet
73+
run: |
74+
if [[ "${{ inputs.root-sbd }}" == "" ]]; then
75+
echo "root-sbd=${{ inputs.model }}" >> $GITHUB_OUTPUT
76+
else
77+
echo "root-sbd=${{ inputs.root-sbd }}" >> $GITHUB_OUTPUT
78+
fi
79+
7080
- name: Check Model Version Modified
7181
id: version
7282
run: |
@@ -103,7 +113,7 @@ jobs:
103113
# for each of the modules
104114
for DEP in $DEPS; do
105115
DEP_VER=''
106-
if [[ "$DEP" == "${{ inputs.root-sbd }}" ]]; then
116+
if [[ "$DEP" == "${{ steps.default.outputs.root-sbd }}" ]]; then
107117
DEP_VER=$(yq '.spack.specs[0] | split("@git.") | .[1]' spack.yaml)
108118
else
109119
DEP_VER=$(yq ".spack.packages.\"$DEP\".require[0] | split(\"@git.\") | .[1]" spack.yaml)

0 commit comments

Comments
 (0)