ci: fail the PyPI publish workflow on an unknown target

A caller passing a target other than pypi or testpypi would skip both
publish jobs and upload nothing; the build job now fails with the value
instead. Empty (the release event) stays valid.
This commit is contained in:
Alex committed 2026-09-08 19:12:28 +01:00
1 parent fa34e0dc01
commit 9e1cead170
1 file changed
+9
+9
View File
@@ -50,6 +50,15 @@ jobs:
# A publishing workflow must not restore a cache another job could have poisoned.
enable-cache: false
- name: The publish target is one this workflow knows
# A caller's typo would otherwise skip both publish jobs and upload nothing.
if: inputs.target != '' && inputs.target != 'pypi' && inputs.target != 'testpypi'
env:
TARGET: ${{ inputs.target }}
run: |
echo "::error::unknown target '$TARGET': expected pypi or testpypi"
exit 1
- name: Build the sdist and wheel
run: uv build