ci: remove actions/setup-python in GHA - #1743
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates GitHub Actions workflows to use astral-sh/setup-uv instead of actions/setup-python and adjusts how the labels tool is installed and invoked, simplifying Python environment management and aligning token usage with current secrets. Flow diagram for updated GitHub Actions CI and labels workflowsflowchart TD
subgraph labels_workflow
L0[checkout]
L1[setup-uv]
L2[uvx labels sync]
L0 --> L1 --> L2
end
subgraph ci_workflow
C0[checkout]
C1[setup-uv matrix python-version]
C2[uv sync]
C3[uv run pytest]
C0 --> C1 --> C2 --> C3
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Switching from
secrets.GITHUB_TOKENtosecrets.GH_PATin the labels workflow will break runs on forks and any repo without that secret configured; consider falling back toGITHUB_TOKENwhenGH_PATis unset or documenting the requirement in the workflow.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Switching from `secrets.GITHUB_TOKEN` to `secrets.GH_PAT` in the labels workflow will break runs on forks and any repo without that secret configured; consider falling back to `GITHUB_TOKEN` when `GH_PAT` is unset or documenting the requirement in the workflow.
## Individual Comments
### Comment 1
<location path=".github/workflows/labels.yml" line_range="17" />
<code_context>
+ - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- name: Sync config with Github
- run: labels -u ${{ github.repository_owner }} -t ${{ secrets.GITHUB_TOKEN }} sync -f .github/labels.toml
+ run: uvx labels -u ${{ github.repository_owner }} -t ${{ secrets.GH_PAT }} sync -f .github/labels.toml
</code_context>
<issue_to_address>
**🚨 question (security):** Switching from `GITHUB_TOKEN` to `GH_PAT` introduces an extra secret that needs careful scope management.
Using `secrets.GH_PAT` instead of `secrets.GITHUB_TOKEN` removes GitHub’s automatic scoping and rotation, so it’s important to ensure `GH_PAT` has only the minimal scopes needed for label syncing and that there’s a defined rotation/revocation process. If `GITHUB_TOKEN` can support these operations, preferring it would simplify and strengthen secret management.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | ||
| - name: Sync config with Github | ||
| run: labels -u ${{ github.repository_owner }} -t ${{ secrets.GITHUB_TOKEN }} sync -f .github/labels.toml | ||
| run: uvx labels -u ${{ github.repository_owner }} -t ${{ secrets.GH_PAT }} sync -f .github/labels.toml |
There was a problem hiding this comment.
🚨 question (security): Switching from GITHUB_TOKEN to GH_PAT introduces an extra secret that needs careful scope management.
Using secrets.GH_PAT instead of secrets.GITHUB_TOKEN removes GitHub’s automatic scoping and rotation, so it’s important to ensure GH_PAT has only the minimal scopes needed for label syncing and that there’s a defined rotation/revocation process. If GITHUB_TOKEN can support these operations, preferring it would simplify and strengthen secret management.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1743 +/- ##
=======================================
Coverage 99.92% 99.92%
=======================================
Files 37 37
Lines 1333 1333
Branches 71 71
=======================================
Hits 1332 1332
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Committed via https://github.com/asottile/all-repos
Summary by Sourcery
Update GitHub workflows to use uv instead of actions/setup-python for Python tooling.
CI: