I have a github action that has an input which should have a default value based on an env.variable
. Because github actions doesn't support env variables in the default
field, I was wondering if I could reassign the inputs.variable
in the steps portion of my action.yml file.
Here's what I've tried so far:
Doesn't work:
...
inputs:
...
mono-build-tag:
description: Release tag to download from the mono-build-repo
# Github Actions complains that env is being used here
default: "${{ env.GODOT_MONO_BUILD_TAG }}"
runs:
using: "composite"
steps:
- ...
...
Doesn't work:
...
inputs:
...
mono-build-tag:
description: Release tag to download from the mono-build-repo
default: ""
runs:
using: "composite"
steps:
- name: Setup default inputs
run: |
if ${{ inputs.mono-build-tag == '' }}; then
# How do I set inputs.mono-build-tag here???
fi
...
You could define the env variable as follow (remember to put string literal in single quotes):
env:
GODOT_MONO_BUILD_TAG: ${{ github.event.inputs.mono-build-repo || 'latest' }}
where latest
should be the default value for the env var