Checks validity of Python build artefacts; call before package publishing.
- name: "Verify Python build artefacts with Twine"
uses: lfreleng-actions/python-twine-check-action@main| Variable Name | Required | Default | Description |
|---|---|---|---|
| PATH_PREFIX | False | Path/directory to Python project code | |
| PATH | False | dist | Path to Python build artefacts |
This action has no outputs, but will exit with an error if artefact validation fails.
When calling this action separate from a build job, ensure build products are available by using upload/download artefacts.
Run lfreleng-actions/python-twine-check-action@main
Run # Verify Python build artefacts with Twine
osc_github_devops-0.1.28.dev1-py3-none-any.whl
osc_github_devops-0.1.28.dev1.tar.gz
Files in specified directory/path: 2
Using: twine==7.0.0
Running: twine check on 2 artefact(s)
Checking dist/osc_github_devops-0.1.28.dev1-py3-none-any.whl: PASSED
Checking dist/osc_github_devops-0.1.28.dev1.tar.gz: PASSED
Verified Python build artefacts with Twine ✅This action pins the twine version in requirements/twine.txt and
installs it with uv into a virtual environment under the runner's
temporary directory, leaving the caller's Python environment untouched.
The action installs uv and a uv-managed Python itself, so callers need
no setup. It runs that Python by absolute path, in isolated mode, so
interpreter settings from earlier steps of the caller's job (PATH,
UV_PYTHON, VIRTUAL_ENV, PYTHONPATH and similar) cannot make it
run an interpreter or module from the caller's workspace. The action
fails if the caller's environment sets UV_NO_MODIFY_PATH, which no
step can unset before setup-uv reads it.
The action trusts the caller's PATH. Its own steps start Python and
uv by absolute path, but the runner itself finds bash on PATH for
every step and setup-uv runs system tools from it, so no composite
action can defend against a caller that has already put a directory
from its checkout on PATH.
Keeping the pin current matters. Twine replaces the list of valid core
metadata versions with its own hard-coded copy, so a stale twine starts
rejecting otherwise valid distributions as soon as a build backend emits
a metadata version it does not recognise. Hatchling 1.30 began emitting
Metadata-Version: 2.5, which every twine before 7.0 refused.
Because a stale pin is not a vulnerability, it raises no security alert. Two mechanisms cover that gap:
- Dependabot proposes the bump weekly.
- The
twine-release-monitorworkflow posts to Slack when the pinned version falls behind the latest release on PyPI.