Skip to content

Pin actions and dependencies in release workflow#796

Open
sethmlarson wants to merge 1 commit into
pypa:mainfrom
sethmlarson:fix-github-actions
Open

Pin actions and dependencies in release workflow#796
sethmlarson wants to merge 1 commit into
pypa:mainfrom
sethmlarson:fix-github-actions

Conversation

@sethmlarson
Copy link
Copy Markdown

Hello! This pins both the GitHub Actions and the Python packages used during the release process. If you want we can also change the frequency of GitHub Actions updates, too. Right now it's daily, with pins maybe that will be overwhelming? Might make sense to change to less frequently.

Copy link
Copy Markdown
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @sethmlarson

Comment on lines +18 to +19
permissions:
contents: read
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be set as default for the repo / org in which case this is kind of redundant here. I don't have access to the settings, so I can't check. It should be under Actions -> General

Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's currently set to allow read & write. The only thing I can see that might require write access is actions/upload-artifact, though I'd guess that artifacts within the actions system are a separate thing and don't need write permission. I'm happy to try switching it to read only if that makes sense.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set it to Read only for all my own projects and upload-artifact still seems to work fine. Based on actions/upload-artifact#197 it seems the action uses some kind of custom token with it's own permission details.

I'd just suggest to try changing it here. We should see if it works during the next workflow run.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that makes sense. I've set it to read-only now, and unchecked "Allow GitHub Actions to create and approve pull requests"

run: |
python flit_core/build_dists.py
pip install requests docutils
python -m pip install -r packages-requirements.txt
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
python -m pip install -r packages-requirements.txt
python -m pip install -r .github/workflows/packages-requirements.txt

?

Comment on lines +38 to +40
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the advantage of using persist-credentials really? The GITHUB_TOKEN is already available to all steps and is configured with read-only anyway.

Comment thread .github/dependabot.yml
Comment on lines 3 to 6
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to adjust that as well, like you suggested.

Comment thread .github/dependabot.yml
cooldown:
default-days: 7
schedule:
interval: "quarterly"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might step this up to monthly 🤷

# This file is autogenerated by pip-compile with Python 3.13
# by the following command:
#
# pip-compile --generate-hashes --output-file=.github/workflows/packages-requirements.txt --pip-args='--only-binary=:all:' --strip-extras .github/workflows/packages-requirements.in
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest, if a new version of one of these packages has a new dependency of its own, is dependabot smart enough to add that to this file? Or even just flag that there's a new dependency that should be pinned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants