-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
locally running workflow with nektos/act fails environment variable was unset #278
Comments
FWIW, it'd be nice to integrate Using trusted publishing is only possible with platforms for which PyPI implemented it, and If you start messing with env vars that GH only sets in OIDC-enabled runtimes, the action may end up thinking that it's available when it isn't. In general, this request sounds similar to #275 in that it attempts running the action in an unsupported/untested env. |
Looking into the log and checking https://github.com/YoraiLevi/pip_installable_module/blob/84d86f0203368f47c604ddb7d26e7419c12bc5de/.github/workflows/python-publish.yml, I can confirm that you are not passing the token to the action (action inputs is not the same as env vars), which triggers an attempt to use trusted publishing where it's physically impossible. Additionally, your workflow should not build the dists in the same job as publishing when OIDC is enabled because you're giving elevated privileges to impersonate your repository to the build dependency tree. |
added
It wasn't clear from the documentation that I could "fall back" on OIDC |
Don't expose that secret to env vars, though. |
I am trying to form a locally reproducible workflow run for testing and experimenting without pushing to github so I am using Act
while the following workflow seem to work ok on github, publishing to test.pypi it doesn't work locally.
gh act --secret-file .env
from the error message I understand that
ACTIONS_ID_TOKEN_REQUEST_URL
is also required and my guess is that it is a url for authentication with github, which even if I were to set, would be detrimental to the purpose of what I am trying to do, run the workflow completely locally and also run on github without any changes to the workflow file (which is why i am ruling out using https://github.com/pypiserver/pypiserver)Do you think it is possible to set up a local "testing" environment for workflows using this publishing action?
Steps to reproduce
setup an account/project on test.pypi accoording to https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#configuring-trusted-publishing
fork using this commit: https://github.com/YoraiLevi/pip_installable_module/tree/84d86f0203368f47c604ddb7d26e7419c12bc5de
have Act installed, https://nektosact.com/installation/gh.html
create a fine grained token with github for the repository forked
populate a
.env
file at the root of the repositoryexecute
gh act --secret-file .env -W .github/workflows/python-publish.yml
output log file: python-publish.log
The text was updated successfully, but these errors were encountered: