Skip to content

Commit 5b98ca0

Browse files
authored
Fix Build GHA cron job (#636)
Input value from `workflow_dispatch` does not work if the action is triggered by cron job or other events. Therefore, this change set default values, ex. unity_version, when the event type is not `workflow_dispatch`.
1 parent 4cd40d0 commit 5b98ca0

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

.github/workflows/build.yaml

+23-4
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,35 @@ env:
3535
hashCommand: "sha256sum"
3636

3737
jobs:
38+
check_and_prepare:
39+
runs-on: ubuntu-latest
40+
outputs:
41+
unity_version: ${{ steps.set_outputs.outputs.unity_version }}
42+
steps:
43+
- id: set_outputs
44+
run: |
45+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
46+
echo "unity_version=${{ github.event.inputs.unity_version }}" >> $GITHUB_OUTPUT
47+
else
48+
# inputs are not available for non "workflow_dispatch" events. Therefore, set default value here.
49+
echo "unity_version=2019" >> $GITHUB_OUTPUT
50+
fi
51+
52+
- name: Print output
53+
run: |
54+
echo outputs.unity_version : ${{ steps.set_outputs.outputs.unity_version }}
55+
3856
build_macos:
39-
name: build-macos-unity${{ inputs.unity_version}}
57+
name: build-macos-unity${{ needs.check_and_prepare.outputs.unity_version }}
58+
needs: [check_and_prepare]
4059
uses: ./.github/workflows/build_macos.yaml
4160
with:
42-
unity_version: ${{ inputs.unity_version}}
61+
unity_version: ${{ needs.check_and_prepare.outputs.unity_version }}
4362

4463
finalizing:
4564
# Only compute SHA hash for macOS build
46-
name: finalizing-macOS-unity${{ inputs.unity_version}}
47-
needs: [build_macos]
65+
name: finalizing-macOS-unity${{ needs.check_and_prepare.outputs.unity_version }}
66+
needs: [check_and_prepare, build_macos]
4867
runs-on: ubuntu-latest
4968
steps:
5069
- name: Fetch All builds

0 commit comments

Comments
 (0)