gh-action-pypi-publish: Publish package fails: KeyError: 'home-page'

Earlier today I could successfully publish my package, but now publishing fails with below trace

Run pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29

[12](https://github.com/rrooggiieerr/homeduino.py/actions/runs/9669117358/job/26675310467#step:7:13)
/usr/bin/docker run --name ca356eede24419184999027e30d2d46_8e78bd --label 106043 --workdir /github/workspace --rm -e "pythonLocation" -e "LD_LIBRARY_PATH" -e "INPUT_USER" -e "INPUT_PASSWORD" -e "INPUT_REPOSITORY_URL" -e "INPUT_PACKAGES_DIR" -e "INPUT_VERIFY_METADATA" -e "INPUT_SKIP_EXISTING" -e "INPUT_VERBOSE" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GIT
[13](https://github.com/rrooggiieerr/homeduino.py/actions/runs/9669117358/job/26675310467#step:7:14)
Traceback (most recent call last):
[14](https://github.com/rrooggiieerr/homeduino.py/actions/runs/9669117358/job/26675310467#step:7:15)
  File "/usr/local/bin/twine", line 5, in <module>
[15](https://github.com/rrooggiieerr/homeduino.py/actions/runs/9669117358/job/26675310467#step:7:16)
    from twine.__main__ import main
[16](https://github.com/rrooggiieerr/homeduino.py/actions/runs/9669117358/job/26675310467#step:7:17)
  File "/usr/local/lib/python3.9/site-packages/twine/__init__.py", line 40, in <module>
[17](https://github.com/rrooggiieerr/homeduino.py/actions/runs/9669117358/job/26675310467#step:7:18)
    __uri__ = metadata["home-page"]
[18](https://github.com/rrooggiieerr/homeduino.py/actions/runs/9669117358/job/26675310467#step:7:19)
  File "/usr/local/lib/python3.9/site-packages/importlib_metadata/_adapters.py", line 54, in __getitem__
[19](https://github.com/rrooggiieerr/homeduino.py/actions/runs/9669117358/job/26675310467#step:7:20)
    raise KeyError(item)
[20](https://github.com/rrooggiieerr/homeduino.py/actions/runs/9669117358/job/26675310467#step:7:21)
KeyError: 'home-page'

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18 (11 by maintainers)

Most upvoted comments

Ah, that explains it all. I probably just used someones else workflow as an example

@rrooggiieerr ah, that’s why I couldn’t understand how that would be affecting this action…

GitHub’s own workflow starters/templates used to pin to something awfully ancient. That commit doesn’t support tokenless publishing as well as any of the other stability/feature/bugfix improvements. Usually, it’s fine to pin to release/v1 which is a rolling branch. If you want more control of the stability/supply chain, though, pin to commit hashes (or tags, but hashes are better security-wise). Dependabot can help you bump the hashes, by the way.

Also, as a general recommendation, I’d recommend following the structure in https://learn.scientific-python.org/development/guides/gha-pure/, it’s a bit more secure to build and publish in separate jobs, and it’s handy to be able to download the files from the action sometimes.

Twine 5.1.0 yanked. Doesn’t explain why this is leaking importlib-metadata 8, though.

Actually looks like it’s set in a requirements.txt. Something must be going wrong with using it.

https://github.com/pypa/twine/issues/1125

Setting PIP_CONSTRAINT to a file with either fix might work.