ci: PyPI publish workflow (Trusted Publishing)#1
Conversation
Publishes to PyPI via OIDC when a GitHub Release is published — no API token. Also ignores build/ and dist/ artifacts.
📝 WalkthroughWalkthroughAdds a GitHub Actions workflow ( ChangesPyPI Publish Workflow
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/publish.yml (2)
13-13: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winDisable credential persistence on checkout.
python -m buildexecutes repository-controlled packaging hooks, so leaving the GitHub token in local git config past checkout is unnecessary exposure in this publish job.Suggested change
- - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + persist-credentials: false🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/publish.yml at line 13, The checkout step in the publish workflow currently leaves credentials persisted in local git config, which is unnecessary for this job. Update the existing actions/checkout usage in the publish workflow to disable credential persistence by setting the appropriate checkout option, so the GitHub token is not retained after checkout while `python -m build` runs packaging hooks.Source: Linters/SAST tools
22-22: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winPin the publish action to a commit SHA.
Using a mutable ref for the release publish step means upstream changes can alter your PyPI release behavior without a code change here. For a publishing workflow, pinning this action to a reviewed SHA is safer.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/publish.yml at line 22, The publish step in the workflow uses a mutable ref for pypa/gh-action-pypi-publish, so update the publish job to reference a reviewed commit SHA instead of release/v1. Keep the change localized to the publish action entry in the workflow and ensure the pinned SHA is the exact version you intend to trust for PyPI releases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/publish.yml:
- Line 13: The checkout step in the publish workflow currently leaves
credentials persisted in local git config, which is unnecessary for this job.
Update the existing actions/checkout usage in the publish workflow to disable
credential persistence by setting the appropriate checkout option, so the GitHub
token is not retained after checkout while `python -m build` runs packaging
hooks.
- Line 22: The publish step in the workflow uses a mutable ref for
pypa/gh-action-pypi-publish, so update the publish job to reference a reviewed
commit SHA instead of release/v1. Keep the change localized to the publish
action entry in the workflow and ensure the pinned SHA is the exact version you
intend to trust for PyPI releases.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2f3af848-3895-417c-9262-8693c5fddbf8
📒 Files selected for processing (2)
.github/workflows/publish.yml.gitignore
Adds
.github/workflows/publish.ymlthat publishes to PyPI via OIDC Trusted Publishing when a GitHub Release is published (no API token). Also ignoresbuild/anddist/.Requires a one-time PyPI pending-publisher config before the first release.