gh-action-pypi-publish: `invalid-publisher` error when using reusable workflow
My publish step sits in a resuable workflow .github/workflows/pytest-release.yml.
When setting up trusted publishing, should the workflow name be the file in the actual repo (test.yml in my case) or the reusable workflow file being exectued (pytest-release.yml)? The docs sound like the former which throws
Error: Trusted publishing exchange failure: Token request failed: the server refused the request for the following reasons:
invalid-publisher: valid token, but no corresponding publisher
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 8
- Comments: 29 (20 by maintainers)
Commits related to this issue
- Move back to tokens - Reusable workflows can't use trusted publishing yet: https://github.com/pypa/gh-action-pypi-publish/issues/166 — committed to robotpy/build-actions by virtuald 3 years ago
- added back username/token for publishing to PyPi as trusted publisher seems not to be supported by PyPi yet. ref: https://github.com/pypa/gh-action-pypi-publish/issues/166 — committed to puckdoug/zpdatafetch by puckdoug 3 years ago
- migrate from pytest-release.yml reusable workflow to separate pytest and pypi publish workflows latter no longer being a reusable workflow so should now work with PyPI trusted publishing (see pypa/gh... — committed to janosh/pymatviz by janosh 2 years ago
- use `pytest-split` in GitHub Action (#224) * use pytest-split in GitHub Action * fix test_set_template breaking test_get_plotly_font_color_default by modifying global plotly template * migrate ... — committed to janosh/pymatviz by janosh 2 years ago
- infra: make publish-release workflow non-reusable This seems to be needed to make sure that trusted publishing (see below link) works properly, since the readme says that it can't work from an reusab... — committed to IRNAS/irnas-east-software by MarkoSagadin 2 years ago
- infra: make publish-release workflow non-reusable This seems to be needed to make sure that trusted publishing (see below link) works properly, since the readme says that it can't work from an reusab... — committed to IRNAS/irnas-east-software by MarkoSagadin 2 years ago
- infra: make publish-release workflow non-reusable This seems to be needed to make sure that trusted publishing (see below link) works properly, since the readme says that it can't work from an reusab... — committed to IRNAS/irnas-east-software by MarkoSagadin 2 years ago
- cicd: fix publishing step There is bug https://github.com/pypa/gh-action-pypi-publish/issues/166 that does not allow to publish from reusable workflows, this is workaround for it. — committed to dkropachev/python-driver by dkropachev 2 years ago
- cicd: fix publishing step (#439) There is bug https://github.com/pypa/gh-action-pypi-publish/issues/166 that does not allow to publish from reusable workflows, this is workaround for it. — committed to scylladb/python-driver by dkropachev 2 years ago
- cicd: move out publishing stage from reusable workflow There is bug in publishing github action: https://github.com/pypa/gh-action-pypi-publish/issues/166 that does not allow to publish from reusable... — committed to scylladb/python-driver by dkropachev 2 years ago
- cicd: move out publishing stage from reusable workflow There is bug in publishing github action: https://github.com/pypa/gh-action-pypi-publish/issues/166 that does not allow to publish from reusable... — committed to scylladb/python-driver by dkropachev 2 years ago
- Fix publishing issue (#442) * cicd: introduce build-test.yml Mantaining file for building and publishing and building for testing is complicated. Let's split them. * cicd: move out publishing stage... — committed to scylladb/python-driver by dkropachev 2 years ago
- use `pytest-split` in GitHub Action (#224) * use pytest-split in GitHub Action * fix test_set_template breaking test_get_plotly_font_color_default by modifying global plotly template * migrate ... — committed to janosh/pymatviz by janosh 2 years ago
This is a very thoughtful offer, thank you! Unfortunately, I can’t really personally take bounties for this kind of work – OSS engineering is my full time job, and I get paid a salary for it. I might do this eventually as a side project, but to do it professionally I’ll need one of my clients (or a new client) to fund it.
(I am happy to discuss that further if you’d like, but I also completely understand if that kind of funding isn’t what you’re interested in.)
@webknjaz you mentioned some folks were able to successfully setup trusted publishers when using reusable workflows from the same repository. I’m trying to do the same, but running into errors even when inheriting secrets. Do you have any examples of a successful configuration here?
For reference my top level workflow is, https://github.com/LLNL/repligit/blob/main/.github/workflows/ci.yml
Which is calling this reusable workflow after unit-tests have all passed, https://github.com/LLNL/repligit/blob/main/.github/workflows/publish.yml
And I’ve set both as trusted publishers on PyPI for the project.
Makes sense! I’ll try and set aside some time to add that warning.
@woodruffw maybe not fail hard but show a big explainer for this specific case? I don’t remember if
workflow_callis exposed as an event. I think it’s the event of the calling workflow that is visible to us. Also, some people managed to get it to work when the reusable workflow is within the same repo and all the secrets are inherited, it seems. I don’t want to break them. But if the upload fails, showing something that is impossible to miss would be a good idea. For some reason I thought we already had that warning in the error messages calling out the reusable workflows special case explicitly but it seems like it’s not there.To add to what @webknjaz said: the limitations with reusable workflows are currently documented here: https://docs.pypi.org/trusted-publishers/troubleshooting/#reusable-workflows-on-github
Adding support for reusable workflows is on my list of things to do, but there’s no current timeline for it.
@mikegerber v1.8.9 has more debug info
Could gh-action-pypi-publish give more debugging info - if possible? Eg. the values of Publisher - Repository - Workflow - Environment name that should be used in the Trusted publisher configuration?
I stumbled upon this, and having the reusable workflow in the same repo also causes this error, it seems.