Enforce that required toolchain input is provided

This commit is contained in:
David Tolnay 2025-08-22 16:56:55 -07:00
parent b3b07ba8b4
commit 87f0783588
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -33,7 +33,11 @@ runs:
- id: parse
run: |
: parse toolchain version
if [[ $toolchain =~ ^stable' '[0-9]+' '(year|month|week|day)s?' 'ago$ ]]; then
if [[ -z $toolchain ]]; then
# GitHub does not enforce `required: true` inputs itself. https://github.com/actions/runner/issues/1070
echo "'toolchain' is a required input" >&2
exit 1
elif [[ $toolchain =~ ^stable' '[0-9]+' '(year|month|week|day)s?' 'ago$ ]]; then
if [[ ${{runner.os}} == macOS ]]; then
echo "toolchain=1.$((($(date -v-$(sed 's/stable \([0-9]*\) \(.\).*/\1\2/' <<< $toolchain) +%s)/60/60/24-16569)/7/6))" >> $GITHUB_OUTPUT
else