Is there an existing issue for this?
What keywords did you use to search existing issues?
error trusted publishing
Please describe the problem you are attempting to solve with this request
When twine upload fails in a Trusted Publishing scenario, the error messages are descriptive but could contain more information that would be useful to debug/solve the issue. For example, when using GH Actions and there's an error getting the OIDC token, twine says:
ERROR TrustedPublishingFailure: Unable to retrieve an OIDC token from the CI
platform for trusted publishing GitHub: missing or insufficient OIDC
token permissions, the ACTIONS_ID_TOKEN_REQUEST_TOKEN environment
variable was unset
In the case of GH Actions, we could say something like
ERROR TrustedPublishingFailure: Unable to retrieve an OIDC token from GitHub
Actions for trusted publishing.
GitHub: missing or insufficient OIDC token permissions, the
ACTIONS_ID_TOKEN_REQUEST_TOKEN environment variable was unset
This generally indicates a workflow configuration error, such as
insufficient permissions. Make sure that your workflow has `id-token:
write` configured at the job level, e.g.:
permissions:
id-token: write
If this workflow was triggered by a pull request from a fork, note that
GitHub does not grant OIDC permissions to those workflows, even when
`id-token: write` is configured. Change the workflow to use an event
that forks cannot trigger, such as a tag or release, or a manual
workflow dispatch.
Learn more at
https://docs.pypi.org/trusted-publishers/using-a-publisher/
This is similar to what the official pypi-publish action does, and doing it in twine would allow the action to fully rely on twine for the Trusted Publishing flow, instead of implementing it from scratch. See the discussion here for more details.
How do you think we should solve this?
Modifying the error messages to be more descriptive, at least in the cases where we already know the likely issue (such as when publishing from GHA)
Anything else you'd like to mention?
No response
Is there an existing issue for this?
What keywords did you use to search existing issues?
error trusted publishing
Please describe the problem you are attempting to solve with this request
When
twine uploadfails in a Trusted Publishing scenario, the error messages are descriptive but could contain more information that would be useful to debug/solve the issue. For example, when using GH Actions and there's an error getting the OIDC token,twinesays:In the case of GH Actions, we could say something like
This is similar to what the official
pypi-publishaction does, and doing it intwinewould allow the action to fully rely ontwinefor the Trusted Publishing flow, instead of implementing it from scratch. See the discussion here for more details.How do you think we should solve this?
Modifying the error messages to be more descriptive, at least in the cases where we already know the likely issue (such as when publishing from GHA)
Anything else you'd like to mention?
No response