🐛 Make kebab options fall back for snake_case

The previous release didn't take into account the action defaults so
the promised fallbacks for the old input names didn't work. This patch
corrects that mistake.
This commit is contained in:
Sviatoslav Sydorenko 2023-03-11 03:06:39 +01:00
parent 7104b6e981
commit 22b4d1f125
No known key found for this signature in database
GPG key ID: 9345E8FEA89CA455
2 changed files with 8 additions and 5 deletions

View file

@ -23,7 +23,7 @@ inputs:
packages-dir: # Canonical alias for `packages_dir` packages-dir: # Canonical alias for `packages_dir`
description: The target directory for distribution description: The target directory for distribution
required: false required: false
default: dist # default: dist # TODO: uncomment once alias removed
packages_dir: # DEPRECATED ALIAS; TODO: Remove in v3+ packages_dir: # DEPRECATED ALIAS; TODO: Remove in v3+
description: >- description: >-
[DEPRECATED] [DEPRECATED]
@ -36,7 +36,7 @@ inputs:
verify-metadata: # Canonical alias for `verify_metadata` verify-metadata: # Canonical alias for `verify_metadata`
description: Check metadata before uploading description: Check metadata before uploading
required: false required: false
default: 'true' # default: 'true' # TODO: uncomment once alias removed
verify_metadata: # DEPRECATED ALIAS; TODO: Remove in v3+ verify_metadata: # DEPRECATED ALIAS; TODO: Remove in v3+
description: >- description: >-
[DEPRECATED] [DEPRECATED]
@ -51,7 +51,7 @@ inputs:
Do not fail if a Python package distribution Do not fail if a Python package distribution
exists in the target package index exists in the target package index
required: false required: false
default: 'false' # default: 'false' # TODO: uncomment once alias removed
skip_existing: # DEPRECATED ALIAS; TODO: Remove in v3+ skip_existing: # DEPRECATED ALIAS; TODO: Remove in v3+
description: >- description: >-
[DEPRECATED] [DEPRECATED]
@ -69,7 +69,7 @@ inputs:
print-hash: # Canonical alias for `print_hash` print-hash: # Canonical alias for `print_hash`
description: Show hash values of files to be uploaded description: Show hash values of files to be uploaded
required: false required: false
default: 'false' # default: 'false' # TODO: uncomment once alias removed
print_hash: # DEPRECATED ALIAS; TODO: Remove in v3+ print_hash: # DEPRECATED ALIAS; TODO: Remove in v3+
description: >- description: >-
[DEPRECATED] [DEPRECATED]

View file

@ -25,7 +25,10 @@ function get-normalized-input() {
from os import getenv from os import getenv
from sys import argv from sys import argv
envvar_name = f"INPUT_{argv[1].upper()}" envvar_name = f"INPUT_{argv[1].upper()}"
print(getenv(envvar_name, getenv(envvar_name.replace("-", "_"), "")), end="") print(
getenv(envvar_name) or getenv(envvar_name.replace("-", "_")) or "",
end="",
)
' \ ' \
"${var_name}" "${var_name}"
} }