Skip to content

Conversation

konstin
Copy link
Contributor

@konstin konstin commented Aug 18, 2025

GitHub has recently added support for requiring pinning hashes in actions (https://github.blog/changelog/2025-08-15-github-actions-policy-now-supports-blocking-and-sha-pinning-actions/, https://docs.github.com/en/actions/reference/security/secure-use#using-third-party-actions). This is more secure - tags can be modified - and prevents CI from breaking on a bad update.

The policy applies transitively to all used actions, which breaks this action when the policy is enabled (https://github.com/astral-sh/uv/actions/runs/17008660079/job/48221734296). This PR switches to using a hash for the action, solving this.

If desired, renovate can be configured to update the hash in regular intervals (pinDigests: true)

GitHub has recently added support for requiring pinning hashes in actions (https://github.blog/changelog/2025-08-15-github-actions-policy-now-supports-blocking-and-sha-pinning-actions/). This is more secure - tags can be changed - and prevents CI from breaking on a bad update.

The policy applies transitively to all used actions, which breaks this action when the policy is enabled (https://github.com/astral-sh/uv/actions/runs/17008660079/job/48221734296).

This PR switches to using a hash for the action.

If desired, renovate can be configured to update the hash (`pinDigests: true`)
action.yml Outdated
Comment on lines 142 to 143
# v5.6.0
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The style that's also used by renovated is having the version comment on the same line as the hash, but then yamllint complains that the line is too long:

Suggested change
# v5.6.0
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0

Copy link
Member

Choose a reason for hiding this comment

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

dependabot also uses this style and will update the comment if it updates the hash

is there a way to silence the lint?

Copy link

Choose a reason for hiding this comment

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

Does this really matter here though?

Copy link
Member

Choose a reason for hiding this comment

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

is there a way to silence the lint?

yamllint has a mechanism for ignores.

Copy link
Member

Choose a reason for hiding this comment

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

@konstin I had some success with # yamllint disable-line rule:line-length in the past could you try appending it? Let's have the inline version comment because Dependabot would understand that. If it doesn't work, there's also a way to disable and then re-enable the rule.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

konstin added a commit to astral-sh/uv that referenced this pull request Aug 18, 2025
janbridley added a commit to janbridley/gh-action-pypi-publish that referenced this pull request Aug 25, 2025
@janbridley
Copy link

Is there any progress on this? It seems that local forks of this repo can't be accessed by the runners by default, so this PR would be a huge help

Copy link
Member

@alex alex left a comment

Choose a reason for hiding this comment

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

ran into this this morning

action.yml Outdated
Comment on lines 142 to 143
# v5.6.0
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
Copy link
Member

Choose a reason for hiding this comment

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

dependabot also uses this style and will update the comment if it updates the hash

is there a way to silence the lint?

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

@konstin thanks for letting me know about the new setting!

In general, I don't like the pinning bots because they are very noisy (this is especially noticable when you get notifications from hundreds of projects). It might feel different to people only maintaining one thing, though.

That said, I've been thinking how to tackle the pinning problem in GHA (especially given my interest in community-shareable reusable workflows). I don't know if Renovate is able to be less noisy than Dependabot but perhaps it's worth a try.

I'm inclined to make use of https://github.com/davidism/gha-update instead, though. With that, I'd run pinning as a part of the release process and keep the rolling branches unpinned.

This would require some automation/infra effort so I'm thinking of making a one-time exception just this once and reverting it later.

action.yml Outdated
Comment on lines 142 to 143
# v5.6.0
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
Copy link
Member

Choose a reason for hiding this comment

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

@konstin I had some success with # yamllint disable-line rule:line-length in the past could you try appending it? Let's have the inline version comment because Dependabot would understand that. If it doesn't work, there's also a way to disable and then re-enable the rule.

@webknjaz
Copy link
Member

webknjaz commented Sep 2, 2025

By the way, does this need a release or would people be able to point to a SHA on a branch? I know this works, just don't know how it'd play with the new policy checks. Does anybody know?

@janbridley
Copy link

By the way, does this need a release or would people be able to point to a SHA on a branch? I know this works, just don't know how it'd play with the new policy checks. Does anybody know?

I've run into issues pulling a SHA from a branch, it seems like the runners aren't able to pull specific hashes without an associated release. I believe there are workarounds if you check out the branch separately, but a release would be ideal.

@konstin
Copy link
Contributor Author

konstin commented Sep 3, 2025

In general, I don't like the pinning bots because they are very noisy (this is especially noticable when you get notifications from hundreds of projects). It might feel different to people only maintaining one thing, though.

That said, I've been thinking how to tackle the pinning problem in GHA (especially given my interest in community-shareable reusable workflows). I don't know if Renovate is able to be less noisy than Dependabot but perhaps it's worth a try.

Renovate has vast flexibility in configuration options, we can configure to any cadence and any grouping. They have a page dedicated to reducing noise in their docs: https://docs.renovatebot.com/noise-reduction/. I can help with an initial renovate config, but this is ultimately a decision for the repo maintainers (and I can't PR adding the renovate app)

@webknjaz
Copy link
Member

webknjaz commented Sep 3, 2025

@konstin thanks! But that wouldn't facilitate my preference of keeping the rolling branches unstable branch unpinned, would it?

@webknjaz webknjaz merged commit 77db1b7 into pypa:unstable/v1 Sep 4, 2025
8 checks passed
@konstin
Copy link
Contributor Author

konstin commented Sep 4, 2025

Renovate can make PRs on a cron schedule to merge into that branch, is there any specific interaction with the unpinning?

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.

5 participants