From 9e1cead170f3d44656da79808c514078b632978c Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 8 Sep 2026 19:12:28 +0100 Subject: [PATCH] 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. --- .github/workflows/pypi-publish.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 6f480f8a..12adcf9b 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -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