Compare commits

..
Author SHA1 Message Date
Kevin StillhammerandAmp 36240b6817 Show the version in release workflow run names (#1151)
Amp-Thread-ID:
https://ampcode.com/threads/T-01a1f946-dd47-72d4-b7b2-01c9221e1843

Co-authored-by: Amp <amp@ampcode.com>
2026-11-20 15:58:31 +01:00
github-actions[bot]andeifinger 18988916a6 docs: update version references to v10.4.0 (#1150)
Update `uses: astral-sh/setup-uv@...` references in documentation to
`1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0`.

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-11-20 15:21:26 +01:00
github-actions[bot]andeifinger 1db35dd8ee chore: update known checksums for 0.13.9 (#1147)
chore: update known checksums for 0.13.9

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-11-18 08:59:05 +01:00
William Woodruff b0fdc328c6 Update CI Node.js to 24.22.1 for the eMudhra fix (#1146)
<details>
<summary>Automated notes</summary>

Use Node.js 24.22.1 for the `setup-node` jobs affected by the eMudhra
intermediate CA compromise. [Node.js security
release](https://nodejs.org/en/blog/vulnerability/october-2026-security-releases)

Both workflow jobs read their Node.js version from `.nvmrc`.

</details>
2026-11-17 15:44:55 -05:00
William Woodruff de938e707d Add the require-checksums input (#1139)
Adds `require-checksums`, which enforces the "intrinsic or explicitly
provided checksum" idea. See #1032.

<details>
<summary>Automated notes</summary>

Add the opt-in input `require-checksums`. When enabled, setup-uv
verifies the archive against the workflow's `checksum` input or the
digest bundled for the resolved uv version, architecture, and platform.
If neither is available, setup fails before downloading the archive. By
default, setup-uv continues to accept manifest checksums as it does
today.

The setting also applies to custom manifests, which can still supply
download URLs. On persistent runners, strict mode keys tool-cache
entries by the expected archive digest so a previous manifest-verified
installation cannot bypass the check.

Closes #1032. Builds on #1033.

## Validation

- `npm ci --ignore-scripts` and `npm run all` passed under Node 24 (182
tests).
- The packaged-action regression test installs a custom build into a
temporary runner tool cache. It checks that strict mode rejects a
manifest-only version even with a warm cache, reuses a verified
installation for the same digest, and rejects a changed digest or a
custom build that conflicts with the bundled digest.

</details>

---------

Signed-off-by: William Woodruff <william@yossarian.net>
2026-11-16 22:24:53 +01:00
William Woodruff fc0acc2d6f Pin astral-sh/github-actions to 2026.11.16.0 (#1145)
Pin the shared actions to commit
`67dc9ee1ddc113eccd8116e7b949fb6cdcd89889` from [release
2026.11.16.0](https://github.com/astral-sh/github-actions/releases/tag/2026.11.16.0).
Add the release version beside each YAML pin.

Parsed the changed YAML and verified that each referenced action or
reusable workflow exists at the pinned commit. The workflow also passed
actionlint and offline zizmor checks.
2026-11-16 12:10:39 -05:00
dependabot[bot] 17e0973e66 chore(deps): bump zizmorcore/zizmor-action from 0.6.4 to 0.7.1 (#1144)
Bumps
[zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action)
from 0.6.4 to 0.7.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/zizmorcore/zizmor-action/releases">zizmorcore/zizmor-action's
releases</a>.</em></p>
<blockquote>
<h2>v0.7.1</h2>
<h1>zizmor changes</h1>
<h2>Bug Fixes 🐛🔗</h2>
<ul>
<li>Fixed a regression in 1.31.0 where some ignore
comments/configurations would no longer apply to the dangerous-triggers
audit</li>
</ul>
<h1>action changes</h1>
<p>The default version of zizmor is now 1.31.1.</p>
<h2>What's Changed</h2>
<ul>
<li>Sync zizmor versions by <a
href="https://github.com/github-actions"><code>@​github-actions</code></a>[bot]
in <a
href="https://redirect.github.com/zizmorcore/zizmor-action/pull/178">zizmorcore/zizmor-action#178</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/zizmorcore/zizmor-action/compare/v0.7.0...v0.7.1">https://github.com/zizmorcore/zizmor-action/compare/v0.7.0...v0.7.1</a></p>
<h2>v0.7.0</h2>
<p><a href="https://github.com/sponsors/woodruffw/">Sponsorship is
appreciated!</a></p>
<h1>zizmor notes</h1>
<h2>Enhancements 🌱<a
href="https://docs.zizmor.sh/release-notes/#enhancements">🔗</a></h2>
<ul>
<li>
<p>The <a
href="https://docs.zizmor.sh/audits/#typosquat-uses">typosquat-uses</a>
audit now supports pre-commit config inputs (<a
href="https://redirect.github.com/zizmorcore/zizmor/issues/2437">#2437</a>)</p>
</li>
<li>
<p>The <a
href="https://docs.zizmor.sh/audits/#self-hosted-runner">self-hosted-runner</a>
audit is now significantly more precise (<a
href="https://redirect.github.com/zizmorcore/zizmor/issues/2350">#2350</a>)</p>
<p>Many thanks to <a
href="https://github.com/ubiratansoares"><code>@​ubiratansoares</code></a>
for proposing and implementing this enhancement!</p>
</li>
<li>
<p>The <a
href="https://docs.zizmor.sh/audits/#dangerous-triggers">dangerous-triggers</a>
audit now considers the issue_comment trigger fundamentally dangerous
(<a
href="https://redirect.github.com/zizmorcore/zizmor/issues/2396">#2396</a>)</p>
</li>
<li>
<p>zizmor is now aware of the image_version workflow trigger (<a
href="https://redirect.github.com/zizmorcore/zizmor/issues/2397">#2397</a>)</p>
</li>
<li>
<p>The <a
href="https://docs.zizmor.sh/audits/#dangerous-triggers">dangerous-triggers</a>
audit now produces more precise finding/diagnostic spans (<a
href="https://redirect.github.com/zizmorcore/zizmor/issues/2402">#2402</a>)</p>
</li>
<li>
<p>The <a
href="https://docs.zizmor.sh/audits/#cache-poisoning">cache-poisoning</a>
audit is now aware of <a
href="https://github.com/pnpm/setup">pnpm/setup</a> (<a
href="https://redirect.github.com/zizmorcore/zizmor/issues/2409">#2409</a>)</p>
</li>
<li>
<p>The <a
href="https://docs.zizmor.sh/audits/#unpinned-images">unpinned-images</a>
audit now produces more precise findings when the user's workflow
contains an indirect matrix (<a
href="https://redirect.github.com/zizmorcore/zizmor/issues/2395">#2395</a>)</p>
<p>Many thanks to <a
href="https://github.com/ubiratansoares"><code>@​ubiratansoares</code></a>
for proposing and implementing this enhancement!</p>
</li>
<li>
<p>The <a
href="https://docs.zizmor.sh/audits/#cache-poisoning">cache-poisoning</a>
audit is now aware of GitHub's new cache-mode: setting, and will skip
any findings that would occur when a job has an effective cache-mode:
none (<a
href="https://redirect.github.com/zizmorcore/zizmor/issues/2418">#2418</a>)</p>
</li>
<li>
<p>The <a
href="https://docs.zizmor.sh/audits/#cache-poisoning">cache-poisoning</a>
audit now flags usages of cache-mode: write and cache-mode: write-only
with dangerous triggers, i.e. triggers that give an attacker privileged
code execution (<a
href="https://redirect.github.com/zizmorcore/zizmor/issues/2426">#2426</a>)</p>
</li>
<li>
<p>zizmor now uses a tree-sitter grammar for PowerShell that's more
precise/capable of capturing more non-trivial PowerShell expressions (<a
href="https://redirect.github.com/zizmorcore/zizmor/issues/2444">#2444</a>)</p>
</li>
</ul>
<h2>Bug Fixes 🐛<a
href="https://docs.zizmor.sh/release-notes/#bug-fixes">🔗</a></h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/zizmorcore/zizmor-action/commit/85b2b9fb8e3325e7a23d7d0a9d7ba5ae0f999e3e"><code>85b2b9f</code></a>
Sync zizmor versions (<a
href="https://redirect.github.com/zizmorcore/zizmor-action/issues/178">#178</a>)</li>
<li><a
href="https://github.com/zizmorcore/zizmor-action/commit/38c745a43764dcc8bcfd364e8295870e252e957c"><code>38c745a</code></a>
README: bump pins (<a
href="https://redirect.github.com/zizmorcore/zizmor-action/issues/177">#177</a>)</li>
<li><a
href="https://github.com/zizmorcore/zizmor-action/commit/f9597c869b2e67095f9b527070297a13a6efe928"><code>f9597c8</code></a>
Sync zizmor versions (<a
href="https://redirect.github.com/zizmorcore/zizmor-action/issues/175">#175</a>)</li>
<li><a
href="https://github.com/zizmorcore/zizmor-action/commit/2181e51ed8d58b9304e4a561374bb36d5599af3a"><code>2181e51</code></a>
Bump sync-zizmor-versions.py to Python 3.11 for locking (<a
href="https://redirect.github.com/zizmorcore/zizmor-action/issues/174">#174</a>)</li>
<li><a
href="https://github.com/zizmorcore/zizmor-action/commit/27d989be9329e6cff7f80baf450ca83bf4c94898"><code>27d989b</code></a>
chore(deps): bump the github-actions group with 2 updates (<a
href="https://redirect.github.com/zizmorcore/zizmor-action/issues/173">#173</a>)</li>
<li><a
href="https://github.com/zizmorcore/zizmor-action/commit/a91218c45134530ecc7aefc3eec3f997a279ad37"><code>a91218c</code></a>
Bootstrap zizmor without Docker (<a
href="https://redirect.github.com/zizmorcore/zizmor-action/issues/169">#169</a>)</li>
<li><a
href="https://github.com/zizmorcore/zizmor-action/commit/ee3f1bf153a9caa7d162d7324ef8314ec3f91862"><code>ee3f1bf</code></a>
chore(deps): bump the github-actions group with 2 updates (<a
href="https://redirect.github.com/zizmorcore/zizmor-action/issues/170">#170</a>)</li>
<li><a
href="https://github.com/zizmorcore/zizmor-action/commit/8eacaa5f3f72b6638f4f87c3f66113bbc0f363dd"><code>8eacaa5</code></a>
README: bump pins (<a
href="https://redirect.github.com/zizmorcore/zizmor-action/issues/167">#167</a>)</li>
<li>See full diff in <a
href="https://github.com/zizmorcore/zizmor-action/compare/cc914d7f3750a2d13d75c7f184a1060aa0e9d482...85b2b9fb8e3325e7a23d7d0a9d7ba5ae0f999e3e">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=zizmorcore/zizmor-action&package-manager=github_actions&previous-version=0.6.4&new-version=0.7.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-16 12:01:35 +01:00
24 changed files with 341 additions and 94 deletions

No files matched your search

+1 -1
View File
@@ -59,7 +59,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below) # If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0 uses: github/codeql-action/autobuild@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
# ℹ️ Command-line programs to run using the OS shell. # ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl # 📚 https://git.io/JvXDl
+1
View File
@@ -1,4 +1,5 @@
name: Release name: Release
run-name: Release v${{ inputs.version }}
on: on:
workflow_dispatch: workflow_dispatch:
+8 -8
View File
@@ -27,7 +27,7 @@ jobs:
- name: Actionlint - name: Actionlint
uses: eifinger/actionlint-action@1fc89649be682d16ec5cf65ea16e269eb88d3982 # v1.10.2 uses: eifinger/actionlint-action@1fc89649be682d16ec5cf65ea16e269eb88d3982 # v1.10.2
- name: Run zizmor - name: Run zizmor
uses: zizmorcore/zizmor-action@cc914d7f3750a2d13d75c7f184a1060aa0e9d482 # v0.6.4 uses: zizmorcore/zizmor-action@85b2b9fb8e3325e7a23d7d0a9d7ba5ae0f999e3e # v0.7.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with: with:
node-version-file: .nvmrc node-version-file: .nvmrc
@@ -54,7 +54,7 @@ jobs:
os: [ubuntu-latest, macos-latest, macos-15, windows-latest] os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
steps: steps:
- if: runner.os == 'macOS' - if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0 uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with: with:
persist-credentials: false persist-credentials: false
@@ -287,7 +287,7 @@ jobs:
checksum: "a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218" checksum: "a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218"
steps: steps:
- if: runner.os == 'macOS' - if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0 uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with: with:
persist-credentials: false persist-credentials: false
@@ -326,7 +326,7 @@ jobs:
os: [ubuntu-latest, macos-latest, macos-15, windows-latest] os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
steps: steps:
- if: runner.os == 'macOS' - if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0 uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
- name: Install default version - name: Install default version
uses: $/ uses: $/
- run: uv tool install ruff==0.14.10 - run: uv tool install ruff==0.14.10
@@ -339,7 +339,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
steps: steps:
- if: runner.os == 'macOS' - if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0 uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with: with:
persist-credentials: false persist-credentials: false
@@ -378,7 +378,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
steps: steps:
- if: runner.os == 'macOS' - if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0 uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
- name: Install latest version - name: Install latest version
id: setup-uv id: setup-uv
uses: $/ uses: $/
@@ -416,7 +416,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
steps: steps:
- if: runner.os == 'macOS' - if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0 uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
- name: Install latest version - name: Install latest version
id: setup-uv id: setup-uv
uses: $/ uses: $/
@@ -567,7 +567,7 @@ jobs:
expected-os: "windows-2025" expected-os: "windows-2025"
steps: steps:
- if: runner.os == 'macOS' - if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0 uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
- name: Setup uv - name: Setup uv
id: setup-uv id: setup-uv
uses: $/ uses: $/
+1 -1
View File
@@ -1 +1 @@
24.19.0 24.22.1
+13 -10
View File
@@ -6,7 +6,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
- Cache the installed version of uv to speed up consecutive runs on self-hosted runners - Cache the installed version of uv to speed up consecutive runs on self-hosted runners
- Register problem matchers for error output - Register problem matchers for error output
- (Optional) Persist the uv's cache in the GitHub Actions Cache - (Optional) Persist the uv's cache in the GitHub Actions Cache
- (Optional) Verify the checksum of the downloaded uv executable - Verify the SHA-256 checksum of the downloaded uv archive
## Contents ## Contents
@@ -27,7 +27,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
```yaml ```yaml
- name: Install the latest version of uv - name: Install the latest version of uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
``` ```
If you do not specify a version, this action will look for a [required-version](https://docs.astral.sh/uv/reference/settings/#required-version) If you do not specify a version, this action will look for a [required-version](https://docs.astral.sh/uv/reference/settings/#required-version)
@@ -43,7 +43,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
```yaml ```yaml
- name: Install uv with all available options - name: Install uv with all available options
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
# The version of uv to install, e.g., "0.5.0", "latest", or "latest-known" (default: searches for version in config files, then latest) # The version of uv to install, e.g., "0.5.0", "latest", or "latest-known" (default: searches for version in config files, then latest)
version: "" version: ""
@@ -75,6 +75,9 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
# The checksum of the uv version to install # The checksum of the uv version to install
checksum: "" checksum: ""
# Require a checksum bundled with setup-uv or supplied through the checksum input
require-checksums: "false"
# Used when downloading uv from GitHub releases # Used when downloading uv from GitHub releases
github-token: ${{ github.token }} github-token: ${{ github.token }}
@@ -161,7 +164,7 @@ python 3.13
``` ```
```yaml ```yaml
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version-file: ".tool-versions" version-file: ".tool-versions"
``` ```
@@ -172,7 +175,7 @@ a warning.
```yaml ```yaml
- name: Install the latest version of uv and set the python version to 3.13t - name: Install the latest version of uv and set the python version to 3.13t
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
python-version: 3.13t python-version: 3.13t
- run: uv pip install --python=3.13t pip - run: uv pip install --python=3.13t pip
@@ -190,7 +193,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
- name: Install the latest version of uv and set the python version - name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Test with python ${{ matrix.python-version }} - name: Test with python ${{ matrix.python-version }}
@@ -226,7 +229,7 @@ It also controls where [the venv gets created](#activate-environment), unless `v
```yaml ```yaml
- name: Install uv based on the config files in the working-directory - name: Install uv based on the config files in the working-directory
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
working-directory: my/subproject/dir working-directory: my/subproject/dir
``` ```
@@ -268,7 +271,7 @@ For example:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@main uses: actions/checkout@main
- name: Install the latest version of uv - name: Install the latest version of uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
- name: Test - name: Test
@@ -280,7 +283,7 @@ To install a specific version of Python, use
```yaml ```yaml
- name: Install the latest version of uv - name: Install the latest version of uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
- name: Install Python 3.12 - name: Install Python 3.12
@@ -299,7 +302,7 @@ output:
uses: actions/checkout@main uses: actions/checkout@main
- name: Install the default version of uv - name: Install the default version of uv
id: setup-uv id: setup-uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
- name: Print the installed version - name: Print the installed version
run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}" run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
``` ```
+2 -2
View File
@@ -56,7 +56,7 @@ test("manifest checksums are used when no known checksum exists", async () => {
).rejects.toThrow("did not match"); ).rejects.toThrow("did not match");
}); });
test("empty manifest checksums are rejected", async () => { test.each(["", undefined])("rejects missing checksums (%s)", async (hash) => {
await expect( await expect(
validateChecksum( validateChecksum(
undefined, undefined,
@@ -64,7 +64,7 @@ test("empty manifest checksums are rejected", async () => {
"aarch64", "aarch64",
"pc-windows-msvc", "pc-windows-msvc",
"1.2.3", "1.2.3",
"", hash,
), ),
).rejects.toThrow("No checksum found"); ).rejects.toThrow("No checksum found");
}); });
@@ -0,0 +1,93 @@
import { execFile, execFileSync } from "node:child_process";
import { createHash } from "node:crypto";
import fs from "node:fs";
import { createServer } from "node:http";
import type { AddressInfo } from "node:net";
import { tmpdir } from "node:os";
import path from "node:path";
import { promisify } from "node:util";
import { expect, test } from "@jest/globals";
import { getArch, getPlatform } from "../../src/utils/platforms";
test("enforces intrinsic checksums on downloads and tool-cache hits", async () => {
const platform = await getPlatform();
const target = `${getArch()}-${platform}`;
const windows = platform === "pc-windows-msvc";
const dir = fs.mkdtempSync(path.join(tmpdir(), "setup-uv-checksums-"));
const server = createServer();
try {
const member = windows ? "uv.exe" : `uv-${target}/uv`;
const archiveName = windows ? "uv.zip" : "uv.tar.gz";
fs.mkdirSync(path.dirname(path.join(dir, member)), { recursive: true });
fs.writeFileSync(path.join(dir, member), "test build");
execFileSync("tar", ["-acf", archiveName, member], { cwd: dir });
const archive = fs.readFileSync(path.join(dir, archiveName));
const digest = createHash("sha256").update(archive).digest("hex");
let downloads = 0;
server.on("request", (_req, res) => {
downloads++;
res.end(archive);
});
await new Promise<void>((resolve) =>
server.listen(0, "127.0.0.1", resolve),
);
const address = server.address() as AddressInfo;
function install(version: string, strict: boolean, checksum = "") {
const manifest = JSON.stringify({
artifacts: [
{
archive_format: windows ? "zip" : "tar.gz",
platform: target,
sha256: digest,
url: `http://127.0.0.1:${address.port}/${archiveName}`,
},
],
version,
});
return promisify(execFile)(process.execPath, ["dist/setup/index.cjs"], {
env: {
"INPUT_ACTIVATE-ENVIRONMENT": "false",
INPUT_CHECKSUM: checksum,
"INPUT_MANIFEST-FILE": `data:application/json,${encodeURIComponent(manifest)}`,
"INPUT_NO-PROJECT": "false",
"INPUT_PYTHON-VERSION": "3.13",
"INPUT_REQUIRE-CHECKSUMS": String(strict),
INPUT_VERSION: version,
"INPUT_WORKING-DIRECTORY": dir,
PATH: process.env.PATH,
RUNNER_TEMP: dir,
RUNNER_TOOL_CACHE: path.join(dir, "cache"),
SystemRoot: process.env.SystemRoot,
},
timeout: 10_000,
});
}
const version = "99.0.0";
await install(version, false);
await expect(install(version, true)).rejects.toMatchObject({
stdout: expect.stringContaining(
`No bundled checksum for ${target}-${version}`,
),
});
expect(downloads).toBe(1);
await install(version, true, digest);
expect(downloads).toBe(2);
await install(version, true, digest);
expect(downloads).toBe(2);
await expect(install(version, true, "0".repeat(64))).rejects.toMatchObject({
stdout: expect.stringContaining("did not match"),
});
// The custom manifest also offers these bytes under a known release version.
await expect(install("0.9.26", true)).rejects.toMatchObject({
stdout: expect.stringContaining("did not match"),
});
await expect(install(version, true, "../uv")).rejects.toMatchObject({
stdout: expect.stringContaining("Expected a SHA-256 checksum"),
});
} finally {
server.close();
fs.rmSync(dir, { force: true, recursive: true });
}
}, 30_000);
+1
View File
@@ -26,6 +26,7 @@ export function createSetupInputs(
pythonDir: "/tmp/uv-python-dir", pythonDir: "/tmp/uv-python-dir",
pythonVersion: "", pythonVersion: "",
quiet: false, quiet: false,
requireChecksums: false,
resolutionStrategy: "highest", resolutionStrategy: "highest",
restoreCache: false, restoreCache: false,
saveCache: true, saveCache: true,
+6
View File
@@ -109,9 +109,15 @@ describe("loadInputs", () => {
expect(inputs.exportPythonArch).toBe(false); expect(inputs.exportPythonArch).toBe(false);
expect(inputs.venvPath).toBe("/workspace/.venv"); expect(inputs.venvPath).toBe("/workspace/.venv");
expect(inputs.manifestFile).toBeUndefined(); expect(inputs.manifestFile).toBeUndefined();
expect(inputs.requireChecksums).toBe(false);
expect(inputs.resolutionStrategy).toBe("highest"); expect(inputs.resolutionStrategy).toBe("highest");
}); });
it("loads require-checksums", () => {
mockInputs["require-checksums"] = "true";
expect(loadInputs().requireChecksums).toBe(true);
});
it("uses the Python version from an explicitly selected .tool-versions file", () => { it("uses the Python version from an explicitly selected .tool-versions file", () => {
mockInputs["working-directory"] = createTempProject({ mockInputs["working-directory"] = createTempProject({
".tool-versions": "uv 0.12.3\npython 3.13.1t\n", ".tool-versions": "uv 0.12.3\npython 3.13.1t\n",
+2
View File
@@ -19,6 +19,8 @@ inputs:
type: string type: string
checksum: checksum:
type: string type: string
require-checksums:
type: boolean
github-token: github-token:
type: string type: string
enable-cache: enable-cache:
+3
View File
@@ -30,6 +30,9 @@ inputs:
checksum: checksum:
description: "The checksum of the uv version to install" description: "The checksum of the uv version to install"
required: false required: false
require-checksums:
description: "Require a SHA-256 checksum bundled with setup-uv or supplied through the checksum input."
default: "false"
github-token: github-token:
description: description:
"Used when downloading uv from GitHub releases." "Used when downloading uv from GitHub releases."
Generated Vendored
+2
View File
@@ -66242,6 +66242,7 @@ function loadInputs() {
const noProject = getBooleanInput("no-project"); const noProject = getBooleanInput("no-project");
const venvPath = getVenvPath(workingDirectory, activateEnvironment); const venvPath = getVenvPath(workingDirectory, activateEnvironment);
const checksum = getInput("checksum"); const checksum = getInput("checksum");
const requireChecksums = getBooleanInput("require-checksums");
const enableCache = getEnableCache(); const enableCache = getEnableCache();
const restoreCache2 = getInput("restore-cache") === "true"; const restoreCache2 = getInput("restore-cache") === "true";
const saveCache4 = getSaveCache(); const saveCache4 = getSaveCache();
@@ -66286,6 +66287,7 @@ function loadInputs() {
pythonDir, pythonDir,
pythonVersion, pythonVersion,
quiet: quiet2, quiet: quiet2,
requireChecksums,
resolutionStrategy, resolutionStrategy,
restoreCache: restoreCache2, restoreCache: restoreCache2,
saveCache: saveCache4, saveCache: saveCache4,
Generated Vendored
+60 -21
View File
@@ -95330,6 +95330,24 @@ var fs10 = __toESM(require("node:fs"), 1);
// src/download/checksum/known-checksums.json // src/download/checksum/known-checksums.json
var known_checksums_default = { var known_checksums_default = {
"aarch64-apple-darwin-0.13.9": "5aeca67f2283f75235de40d0bd9c0a5bbc5fce23b6d48b3bf9fa1b2db08382ca",
"aarch64-pc-windows-msvc-0.13.9": "72eed595983a4d7d22d79f21065b0f4479cc7e5c7a89104bb410c8f47559a878",
"aarch64-unknown-linux-gnu-0.13.9": "0797542018e541a9288855df555c8077eed06f7a47d206362030480e8ecc9f3d",
"aarch64-unknown-linux-musl-0.13.9": "37fbb7c5bc66cf99c12aa881949d216181e201dec449772c4329e56487d61179",
"arm-unknown-linux-musleabihf-0.13.9": "b43b18e668c94f60e39fb91994cd5b4f17474f81d4967039071afb8f18a6b72d",
"armv7-unknown-linux-gnueabihf-0.13.9": "8bd2ce216e6d3fe825ec0fde4532dea708964e8c419844d2ed8e9e7901a7a11e",
"armv7-unknown-linux-musleabihf-0.13.9": "477c4d3759aaf68d76e570da03438d80a6445118e2a3d74500a98144c54324db",
"i686-pc-windows-msvc-0.13.9": "eb4bd7285a512ebc4122f65a21b72e3f7072610d62164f43ca6aca280c39f6fd",
"i686-unknown-linux-gnu-0.13.9": "ef1d3f7464e650d639f41f10130b2d9cb06d4171dd9778beb7f93a6d498812c5",
"i686-unknown-linux-musl-0.13.9": "0fc2dc2355d4d9c8b3695c3a0aedeb6d62ef921e6e78db1bbc0ff32857b944b7",
"powerpc64le-unknown-linux-gnu-0.13.9": "5c074a4a008037787c665081116b5b7bc77161d1b5b47ca936732f84b498b317",
"riscv64gc-unknown-linux-gnu-0.13.9": "96543eb42d59426db0092f1d860f319abb87c83aaa413a9710108cbd4f68c34b",
"riscv64gc-unknown-linux-musl-0.13.9": "0cf8c79c766dcbbc641e2a40f7433491c279a5b39869d6138bcd1c71adf82f93",
"s390x-unknown-linux-gnu-0.13.9": "7e15c75fbd907334790d60037e492877ed053dff82cc1c0e2a1de0825d0d3864",
"x86_64-apple-darwin-0.13.9": "617a3211261b0fc739562f0071aa34e9739797c510208ede8e2977c30903d041",
"x86_64-pc-windows-msvc-0.13.9": "edd61f7f5728a56cc62455386661860bdfc7bab65872f39b0c25bdcc1d8e1beb",
"x86_64-unknown-linux-gnu-0.13.9": "a7fbaff2b9a271d85c1bdb540941090fd1ce011797b4abeb48e4dcd39c2471d5",
"x86_64-unknown-linux-musl-0.13.9": "58ccf5f1792b8a5a88d01bc910ea131a8b3db4a319a17ad5fad75e0845a3e271",
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558", "aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48", "aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585", "aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
@@ -101009,11 +101027,7 @@ async function validateChecksum(checksum, downloadPath, arch3, platform2, versio
const hasManifestChecksum = manifestChecksum !== void 0 && manifestChecksum !== ""; const hasManifestChecksum = manifestChecksum !== void 0 && manifestChecksum !== "";
const checksumToUse = hasProvidedChecksum ? checksum : knownChecksum ?? (hasManifestChecksum ? manifestChecksum : void 0); const checksumToUse = hasProvidedChecksum ? checksum : knownChecksum ?? (hasManifestChecksum ? manifestChecksum : void 0);
if (checksumToUse === void 0) { if (checksumToUse === void 0) {
if (manifestChecksum !== void 0) { throw new Error(`No checksum found for ${key} in manifest.`);
throw new Error(`No checksum found for ${key} in manifest.`);
}
debug(`No checksum found for ${key}.`);
return;
} }
const checksumSource = hasProvidedChecksum ? "provided checksum" : knownChecksum !== void 0 ? `KNOWN_CHECKSUMS entry for ${key}` : "manifest checksum"; const checksumSource = hasProvidedChecksum ? "provided checksum" : knownChecksum !== void 0 ? `KNOWN_CHECKSUMS entry for ${key}` : "manifest checksum";
debug(`Validating checksum using ${checksumSource}.`); debug(`Validating checksum using ${checksumSource}.`);
@@ -102888,18 +102902,30 @@ function minSatisfying3(versions, version3) {
} }
// src/download/download-version.ts // src/download/download-version.ts
function tryGetFromToolCache(arch3, version3) { function getIntrinsicChecksum(key, providedChecksum) {
const checksum = providedChecksum || KNOWN_CHECKSUMS[key];
if (!checksum) {
throw new Error(
`No bundled checksum for ${key}. With require-checksums enabled, update setup-uv or provide the checksum input for this archive.`
);
}
if (!/^[a-f0-9]{64}$/.test(checksum)) {
throw new Error(`Expected a SHA-256 checksum for ${key}.`);
}
return checksum;
}
function tryGetFromToolCache(arch3, version3, toolCacheName = TOOL_CACHE_NAME) {
debug(`Trying to get uv from tool cache for ${version3}...`); debug(`Trying to get uv from tool cache for ${version3}...`);
const cachedVersions = findAllVersions(TOOL_CACHE_NAME, arch3); const cachedVersions = findAllVersions(toolCacheName, arch3);
debug(`Cached versions: ${cachedVersions}`); debug(`Cached versions: ${cachedVersions}`);
let resolvedVersion = evaluateVersions(cachedVersions, version3); let resolvedVersion = evaluateVersions(cachedVersions, version3);
if (resolvedVersion === "") { if (resolvedVersion === "") {
resolvedVersion = version3; resolvedVersion = version3;
} }
const installedPath = find(TOOL_CACHE_NAME, resolvedVersion, arch3); const installedPath = find(toolCacheName, resolvedVersion, arch3);
return { installedPath, version: resolvedVersion }; return { installedPath, version: resolvedVersion };
} }
async function downloadVersion(platform2, arch3, version3, checksum, githubToken, manifestUrl, downloadFromAstralMirror = true) { async function downloadVersion(platform2, arch3, version3, checksum, githubToken, manifestUrl, downloadFromAstralMirror = true, toolCacheName = TOOL_CACHE_NAME) {
const artifact = await getArtifact(version3, arch3, platform2, manifestUrl); const artifact = await getArtifact(version3, arch3, platform2, manifestUrl);
if (!artifact) { if (!artifact) {
throw new Error( throw new Error(
@@ -102919,7 +102945,8 @@ async function downloadVersion(platform2, arch3, version3, checksum, githubToken
version3, version3,
resolvedChecksum, resolvedChecksum,
manifestChecksum, manifestChecksum,
githubTokenForUrl(downloadUrl, githubToken) githubTokenForUrl(downloadUrl, githubToken),
toolCacheName
); );
} catch (err) { } catch (err) {
if (mirrorUrl === void 0) { if (mirrorUrl === void 0) {
@@ -102936,7 +102963,8 @@ async function downloadVersion(platform2, arch3, version3, checksum, githubToken
version3, version3,
resolvedChecksum, resolvedChecksum,
manifestChecksum, manifestChecksum,
githubTokenForUrl(artifact.downloadUrl, githubToken) githubTokenForUrl(artifact.downloadUrl, githubToken),
toolCacheName
); );
} }
} }
@@ -102953,7 +102981,7 @@ function githubTokenForUrl(downloadUrl, githubToken) {
return void 0; return void 0;
} }
} }
async function downloadArtifact(downloadUrl, artifactName, platform2, arch3, version3, checksum, manifestChecksum, githubToken) { async function downloadArtifact(downloadUrl, artifactName, platform2, arch3, version3, checksum, manifestChecksum, githubToken, toolCacheName) {
info2(`Downloading uv from "${downloadUrl}" ...`); info2(`Downloading uv from "${downloadUrl}" ...`);
const downloadPath = await downloadTool( const downloadPath = await downloadTool(
downloadUrl, downloadUrl,
@@ -102985,12 +103013,7 @@ async function downloadArtifact(downloadUrl, artifactName, platform2, arch3, ver
const extractedDir = await extractTar2(downloadPath); const extractedDir = await extractTar2(downloadPath);
uvDir = path15.join(extractedDir, artifactName); uvDir = path15.join(extractedDir, artifactName);
} }
const cachedToolDir = await cacheDir( const cachedToolDir = await cacheDir(uvDir, toolCacheName, version3, arch3);
uvDir,
TOOL_CACHE_NAME,
version3,
arch3
);
return { cachedToolDir, version: version3 }; return { cachedToolDir, version: version3 };
} }
function getMissingArtifactMessage(version3, arch3, platform2, manifestUrl) { function getMissingArtifactMessage(version3, arch3, platform2, manifestUrl) {
@@ -103021,6 +103044,7 @@ function loadInputs() {
const noProject = getBooleanInput("no-project"); const noProject = getBooleanInput("no-project");
const venvPath = getVenvPath(workingDirectory, activateEnvironment2); const venvPath = getVenvPath(workingDirectory, activateEnvironment2);
const checksum = getInput("checksum"); const checksum = getInput("checksum");
const requireChecksums = getBooleanInput("require-checksums");
const enableCache = getEnableCache(); const enableCache = getEnableCache();
const restoreCache3 = getInput("restore-cache") === "true"; const restoreCache3 = getInput("restore-cache") === "true";
const saveCache2 = getSaveCache(); const saveCache2 = getSaveCache();
@@ -103065,6 +103089,7 @@ function loadInputs() {
pythonDir, pythonDir,
pythonVersion, pythonVersion,
quiet: quiet2, quiet: quiet2,
requireChecksums,
resolutionStrategy, resolutionStrategy,
restoreCache: restoreCache3, restoreCache: restoreCache3,
saveCache: saveCache2, saveCache: saveCache2,
@@ -103502,7 +103527,20 @@ async function setupUv(inputs, platform2, arch3) {
versionFile: inputs.versionFile, versionFile: inputs.versionFile,
workingDirectory: inputs.workingDirectory workingDirectory: inputs.workingDirectory
}); });
const toolCacheResult = tryGetFromToolCache(arch3, resolvedVersion); let checksum = inputs.checksum;
let toolCacheName = TOOL_CACHE_NAME;
if (inputs.requireChecksums) {
checksum = getIntrinsicChecksum(
`${arch3}-${platform2}-${resolvedVersion}`,
inputs.checksum
);
toolCacheName = `${TOOL_CACHE_NAME}-${checksum}`;
}
const toolCacheResult = tryGetFromToolCache(
arch3,
resolvedVersion,
toolCacheName
);
if (toolCacheResult.installedPath) { if (toolCacheResult.installedPath) {
info2(`Found uv in tool-cache for ${toolCacheResult.version}`); info2(`Found uv in tool-cache for ${toolCacheResult.version}`);
return { return {
@@ -103514,10 +103552,11 @@ async function setupUv(inputs, platform2, arch3) {
platform2, platform2,
arch3, arch3,
resolvedVersion, resolvedVersion,
inputs.checksum, checksum,
inputs.githubToken, inputs.githubToken,
inputs.manifestFile, inputs.manifestFile,
inputs.downloadFromAstralMirror inputs.downloadFromAstralMirror,
toolCacheName
); );
return { return {
uvDir: downloadResult.cachedToolDir, uvDir: downloadResult.cachedToolDir,
+18
View File
@@ -47954,6 +47954,24 @@ var semver = __toESM(require_semver(), 1);
// src/download/checksum/known-checksums.json // src/download/checksum/known-checksums.json
var known_checksums_default = { var known_checksums_default = {
"aarch64-apple-darwin-0.13.9": "5aeca67f2283f75235de40d0bd9c0a5bbc5fce23b6d48b3bf9fa1b2db08382ca",
"aarch64-pc-windows-msvc-0.13.9": "72eed595983a4d7d22d79f21065b0f4479cc7e5c7a89104bb410c8f47559a878",
"aarch64-unknown-linux-gnu-0.13.9": "0797542018e541a9288855df555c8077eed06f7a47d206362030480e8ecc9f3d",
"aarch64-unknown-linux-musl-0.13.9": "37fbb7c5bc66cf99c12aa881949d216181e201dec449772c4329e56487d61179",
"arm-unknown-linux-musleabihf-0.13.9": "b43b18e668c94f60e39fb91994cd5b4f17474f81d4967039071afb8f18a6b72d",
"armv7-unknown-linux-gnueabihf-0.13.9": "8bd2ce216e6d3fe825ec0fde4532dea708964e8c419844d2ed8e9e7901a7a11e",
"armv7-unknown-linux-musleabihf-0.13.9": "477c4d3759aaf68d76e570da03438d80a6445118e2a3d74500a98144c54324db",
"i686-pc-windows-msvc-0.13.9": "eb4bd7285a512ebc4122f65a21b72e3f7072610d62164f43ca6aca280c39f6fd",
"i686-unknown-linux-gnu-0.13.9": "ef1d3f7464e650d639f41f10130b2d9cb06d4171dd9778beb7f93a6d498812c5",
"i686-unknown-linux-musl-0.13.9": "0fc2dc2355d4d9c8b3695c3a0aedeb6d62ef921e6e78db1bbc0ff32857b944b7",
"powerpc64le-unknown-linux-gnu-0.13.9": "5c074a4a008037787c665081116b5b7bc77161d1b5b47ca936732f84b498b317",
"riscv64gc-unknown-linux-gnu-0.13.9": "96543eb42d59426db0092f1d860f319abb87c83aaa413a9710108cbd4f68c34b",
"riscv64gc-unknown-linux-musl-0.13.9": "0cf8c79c766dcbbc641e2a40f7433491c279a5b39869d6138bcd1c71adf82f93",
"s390x-unknown-linux-gnu-0.13.9": "7e15c75fbd907334790d60037e492877ed053dff82cc1c0e2a1de0825d0d3864",
"x86_64-apple-darwin-0.13.9": "617a3211261b0fc739562f0071aa34e9739797c510208ede8e2977c30903d041",
"x86_64-pc-windows-msvc-0.13.9": "edd61f7f5728a56cc62455386661860bdfc7bab65872f39b0c25bdcc1d8e1beb",
"x86_64-unknown-linux-gnu-0.13.9": "a7fbaff2b9a271d85c1bdb540941090fd1ce011797b4abeb48e4dcd39c2471d5",
"x86_64-unknown-linux-musl-0.13.9": "58ccf5f1792b8a5a88d01bc910ea131a8b3db4a319a17ad5fad75e0845a3e271",
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558", "aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48", "aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585", "aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
+12 -10
View File
@@ -6,7 +6,7 @@ This document covers advanced options for configuring which version of uv to ins
```yaml ```yaml
- name: Install the latest version of uv - name: Install the latest version of uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version: "latest" version: "latest"
``` ```
@@ -15,11 +15,13 @@ This document covers advanced options for configuring which version of uv to ins
Use `latest-known` to install the newest uv version whose checksums were bundled with the version of setup-uv used by your workflow. Version resolution is performed locally without fetching the latest release, so updating setup-uv also updates the version selected by `latest-known`. Use `latest-known` to install the newest uv version whose checksums were bundled with the version of setup-uv used by your workflow. Version resolution is performed locally without fetching the latest release, so updating setup-uv also updates the version selected by `latest-known`.
When `manifest-file` is set, `latest-known` still selects a version from setup-uv's bundled checksum table, but the artifact and checksum come from the custom manifest. When `manifest-file` is set, `latest-known` still selects a version from setup-uv's bundled checksum table.
By default the custom manifest supplies the artifact and checksum. To require a bundled or explicitly
supplied checksum, enable `require-checksums`. [Checksum validation](customization.md#validate-checksum)
```yaml ```yaml
- name: Install the latest version of uv known to setup-uv - name: Install the latest version of uv known to setup-uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version: "latest-known" version: "latest-known"
``` ```
@@ -28,7 +30,7 @@ When `manifest-file` is set, `latest-known` still selects a version from setup-u
```yaml ```yaml
- name: Install a specific version of uv - name: Install a specific version of uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version: "0.4.4" version: "0.4.4"
``` ```
@@ -41,21 +43,21 @@ to install the latest version that satisfies the range.
```yaml ```yaml
- name: Install a semver range of uv - name: Install a semver range of uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version: ">=0.4.0" version: ">=0.4.0"
``` ```
```yaml ```yaml
- name: Pinning a minor version of uv - name: Pinning a minor version of uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version: "0.4.x" version: "0.4.x"
``` ```
```yaml ```yaml
- name: Install a pep440-specifier-satisfying version of uv - name: Install a pep440-specifier-satisfying version of uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version: ">=0.4.25,<0.5" version: ">=0.4.25,<0.5"
``` ```
@@ -67,7 +69,7 @@ You can change this behavior using the `resolution-strategy` input:
```yaml ```yaml
- name: Install the lowest compatible version of uv - name: Install the lowest compatible version of uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version: ">=0.4.0" version: ">=0.4.0"
resolution-strategy: "lowest" resolution-strategy: "lowest"
@@ -92,7 +94,7 @@ as `UV_PYTHON`. Only a single Python version is supported; multiple fallback ver
```yaml ```yaml
- name: Install uv based on the version defined in pyproject.toml - name: Install uv based on the version defined in pyproject.toml
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version-file: "pyproject.toml" version-file: "pyproject.toml"
``` ```
@@ -103,7 +105,7 @@ silently picking up a newer uv until the lockfile is updated.
```yaml ```yaml
- name: Install uv based on the version locked in uv.lock - name: Install uv based on the version locked in uv.lock
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version-file: "uv.lock" version-file: "uv.lock"
``` ```
+12 -12
View File
@@ -24,7 +24,7 @@ The computed cache key is available as the `cache-key` output:
```yaml ```yaml
- name: Setup uv - name: Setup uv
id: setup-uv id: setup-uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
- name: Print cache key - name: Print cache key
@@ -54,7 +54,7 @@ You can optionally define a custom cache key suffix.
```yaml ```yaml
- name: Enable caching and define a custom cache key suffix - name: Enable caching and define a custom cache key suffix
id: setup-uv id: setup-uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
cache-suffix: "optional-suffix" cache-suffix: "optional-suffix"
@@ -93,7 +93,7 @@ changes. If you use relative paths, they are relative to the working directory.
```yaml ```yaml
- name: Define a cache dependency glob - name: Define a cache dependency glob
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
cache-dependency-glob: "**/pyproject.toml" cache-dependency-glob: "**/pyproject.toml"
@@ -101,7 +101,7 @@ changes. If you use relative paths, they are relative to the working directory.
```yaml ```yaml
- name: Define a list of cache dependency globs - name: Define a list of cache dependency globs
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
@@ -111,7 +111,7 @@ changes. If you use relative paths, they are relative to the working directory.
```yaml ```yaml
- name: Define an absolute cache dependency glob - name: Define an absolute cache dependency glob
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
cache-dependency-glob: "/tmp/my-folder/requirements*.txt" cache-dependency-glob: "/tmp/my-folder/requirements*.txt"
@@ -119,7 +119,7 @@ changes. If you use relative paths, they are relative to the working directory.
```yaml ```yaml
- name: Never invalidate the cache - name: Never invalidate the cache
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
cache-dependency-glob: "" cache-dependency-glob: ""
@@ -132,7 +132,7 @@ By default, the cache will be restored.
```yaml ```yaml
- name: Don't restore an existing cache - name: Don't restore an existing cache
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
restore-cache: false restore-cache: false
@@ -148,7 +148,7 @@ these events. Set `save-cache: true` to save the cache for all events.
```yaml ```yaml
- name: Don't save the cache after the run - name: Don't save the cache after the run
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
save-cache: false save-cache: false
@@ -174,7 +174,7 @@ It defaults to `setup-uv-cache` in the `TMP` dir, `D:\a\_temp\setup-uv-cache` on
```yaml ```yaml
- name: Define a custom uv cache path - name: Define a custom uv cache path
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
cache-local-path: "/path/to/cache" cache-local-path: "/path/to/cache"
``` ```
@@ -191,7 +191,7 @@ If you want to prune the cache before saving it, enable cache pruning with the `
```yaml ```yaml
- name: Prune the cache before saving it - name: Prune the cache before saving it
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
prune-cache: true prune-cache: true
@@ -210,7 +210,7 @@ To force managed Python installs, set `UV_PYTHON_PREFERENCE=only-managed`.
```yaml ```yaml
- name: Cache Python installs - name: Cache Python installs
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
cache-python: true cache-python: true
@@ -228,7 +228,7 @@ If you want to ignore this, set the `ignore-nothing-to-cache` input to `true`.
```yaml ```yaml
- name: Ignore nothing to cache - name: Ignore nothing to cache
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
enable-cache: true enable-cache: true
ignore-nothing-to-cache: true ignore-nothing-to-cache: true
+27 -4
View File
@@ -4,19 +4,42 @@ This document covers advanced customization options including checksum validatio
## Validate checksum ## Validate checksum
Downloaded executables are automatically verified using checksums bundled with this action or, Downloaded archives are automatically verified using checksums bundled with this action or,
for newer, not yet bundled versions, the checksum from [`astral-sh/versions`](https://github.com/astral-sh/versions). for newer, not yet bundled versions, the checksum from [`astral-sh/versions`](https://github.com/astral-sh/versions).
You can specify a checksum to override those values. The sha256 hashes can also be found on the You can specify a checksum to override those values. The sha256 hashes can also be found on the
[releases page](https://github.com/astral-sh/uv/releases) of the uv repo. [releases page](https://github.com/astral-sh/uv/releases) of the uv repo.
```yaml ```yaml
- name: Install a specific version and validate the checksum - name: Install a specific version and validate the checksum
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
version: "0.3.1" version: "0.3.1"
checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8" checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
``` ```
For an additional layer of protection, you can set `require-checksums: true`.
This prevents setup-uv from trusting an unknown version's checksum from
[`astral-sh/versions`](https://github.com/astral-sh/versions) *unless* it is also
present in the action's own bundled data *or* explicitly provided with `checksum`.
This can be combined with `version: latest-known` to select the newest bundled release,
meaning that this newer requires an external checksum source:
```yaml
- name: Install the latest known version of uv
uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with:
version: latest-known
require-checksums: true
```
With this mode, you'll need to update setup-uv itself to get newer uv versions
*unless* you explicitly pass in a `checksum` with a version that post-dates the setup-uv
release.
On runners with a persistent tool cache, this mode reuses only installations previously verified
against the same digest. The first run may download uv again.
## Manifest file ## Manifest file
By default, setup-uv reads version metadata from By default, setup-uv reads version metadata from
@@ -42,7 +65,7 @@ The `archive_format` field is currently ignored.
```yaml ```yaml
- name: Use a custom manifest file - name: Use a custom manifest file
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
manifest-file: "https://example.com/my-custom-manifest.ndjson" manifest-file: "https://example.com/my-custom-manifest.ndjson"
``` ```
@@ -61,7 +84,7 @@ You can disable this by setting the `add-problem-matchers` input to `false`.
```yaml ```yaml
- name: Install the latest version of uv without problem matchers - name: Install the latest version of uv without problem matchers
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
add-problem-matchers: false add-problem-matchers: false
``` ```
+8 -8
View File
@@ -9,7 +9,7 @@ This allows directly using it in later steps:
```yaml ```yaml
- name: Install the latest version of uv and activate the environment - name: Install the latest version of uv and activate the environment
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
activate-environment: true activate-environment: true
- run: uv pip install pip - run: uv pip install pip
@@ -32,7 +32,7 @@ key: build-${{ runner.os }}-${{ runner.arch }}-${{ steps.setup-uv.outputs.python
You can customize the venv location with `venv-path`, for example to place it in the runner temp directory: You can customize the venv location with `venv-path`, for example to place it in the runner temp directory:
```yaml ```yaml
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
activate-environment: true activate-environment: true
venv-path: ${{ runner.temp }}/custom-venv venv-path: ${{ runner.temp }}/custom-venv
@@ -64,7 +64,7 @@ are not sufficient, you can provide a custom GitHub token with the necessary per
```yaml ```yaml
- name: Install the latest version of uv with a custom GitHub token - name: Install the latest version of uv with a custom GitHub token
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
``` ```
@@ -82,7 +82,7 @@ input:
```yaml ```yaml
- name: Install the latest version of uv with a custom tool dir - name: Install the latest version of uv with a custom tool dir
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
tool-dir: "/path/to/tool/dir" tool-dir: "/path/to/tool/dir"
``` ```
@@ -101,7 +101,7 @@ If you want to change this behaviour (especially on self-hosted runners) you can
```yaml ```yaml
- name: Install the latest version of uv with a custom tool bin dir - name: Install the latest version of uv with a custom tool bin dir
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
tool-bin-dir: "/path/to/tool-bin/dir" tool-bin-dir: "/path/to/tool-bin/dir"
``` ```
@@ -118,7 +118,7 @@ This action supports expanding the `~` character to the user's home directory fo
```yaml ```yaml
- name: Expand the tilde character - name: Expand the tilde character
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
cache-local-path: "~/path/to/cache" cache-local-path: "~/path/to/cache"
tool-dir: "~/path/to/tool/dir" tool-dir: "~/path/to/tool/dir"
@@ -135,7 +135,7 @@ If you want to ignore this, set the `ignore-empty-workdir` input to `true`.
```yaml ```yaml
- name: Ignore empty workdir - name: Ignore empty workdir
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
ignore-empty-workdir: true ignore-empty-workdir: true
``` ```
@@ -161,7 +161,7 @@ This action sets several environment variables that influence uv's behavior and
```yaml ```yaml
- name: Example using environment variables - name: Example using environment variables
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with: with:
python-version: "3.12" python-version: "3.12"
tool-dir: "/custom/tool/dir" tool-dir: "/custom/tool/dir"
+1 -1
View File
@@ -38,7 +38,7 @@ Material failures are unauthorized executable selection, credential disclosure,
### Security invariants ### Security invariants
1. **Published runtime:** review `action.yml`, committed `dist/*.cjs`, and runner-interpreted shipped files; source-only fixes do not protect consumers. 1. **Published runtime:** review `action.yml`, committed `dist/*.cjs`, and runner-interpreted shipped files; source-only fixes do not protect consumers.
2. **Executable identity:** precedence is workflow version, version file, project configuration, then `latest`. Manifest authority, platform, variant, URL, checksum, mirror fallback, extraction, and cache placement must bind the intended artifact. A tool-cache hit bypasses download validation and depends on cache provenance. 2. **Executable identity:** precedence is workflow version, version file, project configuration, then `latest`. Manifest authority, platform, variant, URL, checksum, mirror fallback, extraction, and cache placement must bind the intended artifact. A tool-cache hit bypasses download validation and depends on cache provenance. With `require-checksums`, only entries keyed by the explicit or bundled archive digest are eligible.
3. **Credential recipients:** tokens and URL credentials may reach only workflow-authorized origins, redirects, paths, and logs. Metadata authority does not imply token-recipient authority. 3. **Credential recipients:** tokens and URL credentials may reach only workflow-authorized origins, redirects, paths, and logs. Metadata authority does not imply token-recipient authority.
4. **Executable boundaries:** checkout-selected interpreters are authorized by default. Explicit workflow selections must win, and independent cache, runner, or remote state must not substitute executables or gain additional authority. 4. **Executable boundaries:** checkout-selected interpreters are authorized by default. Explicit workflow selections must win, and independent cache, runner, or remote state must not substitute executables or gain additional authority.
5. **Paths and action channels:** path/environment changes, virtual-environment clearing, outputs, state, and problem matchers must affect only authorized targets and keep untrusted values as data. 5. **Paths and action channels:** path/environment changes, virtual-environment clearing, outputs, state, and problem matchers must affect only authorized targets and keep untrusted values as data.
+1 -5
View File
@@ -23,11 +23,7 @@ export async function validateChecksum(
: (knownChecksum ?? (hasManifestChecksum ? manifestChecksum : undefined)); : (knownChecksum ?? (hasManifestChecksum ? manifestChecksum : undefined));
if (checksumToUse === undefined) { if (checksumToUse === undefined) {
if (manifestChecksum !== undefined) { throw new Error(`No checksum found for ${key} in manifest.`);
throw new Error(`No checksum found for ${key} in manifest.`);
}
core.debug(`No checksum found for ${key}.`);
return;
} }
const checksumSource = hasProvidedChecksum const checksumSource = hasProvidedChecksum
+18
View File
@@ -1,4 +1,22 @@
{ {
"aarch64-apple-darwin-0.13.9": "5aeca67f2283f75235de40d0bd9c0a5bbc5fce23b6d48b3bf9fa1b2db08382ca",
"aarch64-pc-windows-msvc-0.13.9": "72eed595983a4d7d22d79f21065b0f4479cc7e5c7a89104bb410c8f47559a878",
"aarch64-unknown-linux-gnu-0.13.9": "0797542018e541a9288855df555c8077eed06f7a47d206362030480e8ecc9f3d",
"aarch64-unknown-linux-musl-0.13.9": "37fbb7c5bc66cf99c12aa881949d216181e201dec449772c4329e56487d61179",
"arm-unknown-linux-musleabihf-0.13.9": "b43b18e668c94f60e39fb91994cd5b4f17474f81d4967039071afb8f18a6b72d",
"armv7-unknown-linux-gnueabihf-0.13.9": "8bd2ce216e6d3fe825ec0fde4532dea708964e8c419844d2ed8e9e7901a7a11e",
"armv7-unknown-linux-musleabihf-0.13.9": "477c4d3759aaf68d76e570da03438d80a6445118e2a3d74500a98144c54324db",
"i686-pc-windows-msvc-0.13.9": "eb4bd7285a512ebc4122f65a21b72e3f7072610d62164f43ca6aca280c39f6fd",
"i686-unknown-linux-gnu-0.13.9": "ef1d3f7464e650d639f41f10130b2d9cb06d4171dd9778beb7f93a6d498812c5",
"i686-unknown-linux-musl-0.13.9": "0fc2dc2355d4d9c8b3695c3a0aedeb6d62ef921e6e78db1bbc0ff32857b944b7",
"powerpc64le-unknown-linux-gnu-0.13.9": "5c074a4a008037787c665081116b5b7bc77161d1b5b47ca936732f84b498b317",
"riscv64gc-unknown-linux-gnu-0.13.9": "96543eb42d59426db0092f1d860f319abb87c83aaa413a9710108cbd4f68c34b",
"riscv64gc-unknown-linux-musl-0.13.9": "0cf8c79c766dcbbc641e2a40f7433491c279a5b39869d6138bcd1c71adf82f93",
"s390x-unknown-linux-gnu-0.13.9": "7e15c75fbd907334790d60037e492877ed053dff82cc1c0e2a1de0825d0d3864",
"x86_64-apple-darwin-0.13.9": "617a3211261b0fc739562f0071aa34e9739797c510208ede8e2977c30903d041",
"x86_64-pc-windows-msvc-0.13.9": "edd61f7f5728a56cc62455386661860bdfc7bab65872f39b0c25bdcc1d8e1beb",
"x86_64-unknown-linux-gnu-0.13.9": "a7fbaff2b9a271d85c1bdb540941090fd1ce011797b4abeb48e4dcd39c2471d5",
"x86_64-unknown-linux-musl-0.13.9": "58ccf5f1792b8a5a88d01bc910ea131a8b3db4a319a17ad5fad75e0845a3e271",
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558", "aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48", "aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585", "aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
+25 -8
View File
@@ -11,22 +11,40 @@ import {
import * as log from "../utils/logging"; import * as log from "../utils/logging";
import type { Architecture, Platform } from "../utils/platforms"; import type { Architecture, Platform } from "../utils/platforms";
import { validateChecksum } from "./checksum/checksum"; import { validateChecksum } from "./checksum/checksum";
import { KNOWN_CHECKSUMS } from "./checksum/known-checksums";
import { getArtifact } from "./manifest"; import { getArtifact } from "./manifest";
export { resolveVersion } from "../version/resolve"; export { resolveVersion } from "../version/resolve";
export function getIntrinsicChecksum(
key: string,
providedChecksum: string,
): string {
const checksum = providedChecksum || KNOWN_CHECKSUMS[key];
if (!checksum) {
throw new Error(
`No bundled checksum for ${key}. With require-checksums enabled, update setup-uv or provide the checksum input for this archive.`,
);
}
if (!/^[a-f0-9]{64}$/.test(checksum)) {
throw new Error(`Expected a SHA-256 checksum for ${key}.`);
}
return checksum;
}
export function tryGetFromToolCache( export function tryGetFromToolCache(
arch: Architecture, arch: Architecture,
version: string, version: string,
toolCacheName = TOOL_CACHE_NAME,
): { version: string; installedPath: string | undefined } { ): { version: string; installedPath: string | undefined } {
core.debug(`Trying to get uv from tool cache for ${version}...`); core.debug(`Trying to get uv from tool cache for ${version}...`);
const cachedVersions = tc.findAllVersions(TOOL_CACHE_NAME, arch); const cachedVersions = tc.findAllVersions(toolCacheName, arch);
core.debug(`Cached versions: ${cachedVersions}`); core.debug(`Cached versions: ${cachedVersions}`);
let resolvedVersion = tc.evaluateVersions(cachedVersions, version); let resolvedVersion = tc.evaluateVersions(cachedVersions, version);
if (resolvedVersion === "") { if (resolvedVersion === "") {
resolvedVersion = version; resolvedVersion = version;
} }
const installedPath = tc.find(TOOL_CACHE_NAME, resolvedVersion, arch); const installedPath = tc.find(toolCacheName, resolvedVersion, arch);
return { installedPath, version: resolvedVersion }; return { installedPath, version: resolvedVersion };
} }
@@ -38,6 +56,7 @@ export async function downloadVersion(
githubToken: string, githubToken: string,
manifestUrl?: string, manifestUrl?: string,
downloadFromAstralMirror = true, downloadFromAstralMirror = true,
toolCacheName = TOOL_CACHE_NAME,
): Promise<{ version: string; cachedToolDir: string }> { ): Promise<{ version: string; cachedToolDir: string }> {
const artifact = await getArtifact(version, arch, platform, manifestUrl); const artifact = await getArtifact(version, arch, platform, manifestUrl);
@@ -71,6 +90,7 @@ export async function downloadVersion(
resolvedChecksum, resolvedChecksum,
manifestChecksum, manifestChecksum,
githubTokenForUrl(downloadUrl, githubToken), githubTokenForUrl(downloadUrl, githubToken),
toolCacheName,
); );
} catch (err) { } catch (err) {
if (mirrorUrl === undefined) { if (mirrorUrl === undefined) {
@@ -90,6 +110,7 @@ export async function downloadVersion(
resolvedChecksum, resolvedChecksum,
manifestChecksum, manifestChecksum,
githubTokenForUrl(artifact.downloadUrl, githubToken), githubTokenForUrl(artifact.downloadUrl, githubToken),
toolCacheName,
); );
} }
} }
@@ -128,6 +149,7 @@ async function downloadArtifact(
checksum: string | undefined, checksum: string | undefined,
manifestChecksum: string | undefined, manifestChecksum: string | undefined,
githubToken: string | undefined, githubToken: string | undefined,
toolCacheName: string,
): Promise<{ version: string; cachedToolDir: string }> { ): Promise<{ version: string; cachedToolDir: string }> {
log.info(`Downloading uv from "${downloadUrl}" ...`); log.info(`Downloading uv from "${downloadUrl}" ...`);
const downloadPath = await tc.downloadTool( const downloadPath = await tc.downloadTool(
@@ -165,12 +187,7 @@ async function downloadArtifact(
uvDir = path.join(extractedDir, artifactName); uvDir = path.join(extractedDir, artifactName);
} }
const cachedToolDir = await tc.cacheDir( const cachedToolDir = await tc.cacheDir(uvDir, toolCacheName, version, arch);
uvDir,
TOOL_CACHE_NAME,
version,
arch,
);
return { cachedToolDir, version }; return { cachedToolDir, version };
} }
+23 -3
View File
@@ -5,9 +5,14 @@ import * as exec from "@actions/exec";
import { restoreCache } from "./cache/restore-cache"; import { restoreCache } from "./cache/restore-cache";
import { import {
downloadVersion, downloadVersion,
getIntrinsicChecksum,
tryGetFromToolCache, tryGetFromToolCache,
} from "./download/download-version"; } from "./download/download-version";
import { STATE_UV_PATH, STATE_UV_VERSION } from "./utils/constants"; import {
STATE_UV_PATH,
STATE_UV_VERSION,
TOOL_CACHE_NAME,
} from "./utils/constants";
import { CacheLocalSource, loadInputs, type SetupInputs } from "./utils/inputs"; import { CacheLocalSource, loadInputs, type SetupInputs } from "./utils/inputs";
import * as log from "./utils/logging"; import * as log from "./utils/logging";
import { import {
@@ -147,7 +152,21 @@ async function setupUv(
versionFile: inputs.versionFile, versionFile: inputs.versionFile,
workingDirectory: inputs.workingDirectory, workingDirectory: inputs.workingDirectory,
}); });
const toolCacheResult = tryGetFromToolCache(arch, resolvedVersion); let checksum = inputs.checksum;
let toolCacheName = TOOL_CACHE_NAME;
if (inputs.requireChecksums) {
checksum = getIntrinsicChecksum(
`${arch}-${platform}-${resolvedVersion}`,
inputs.checksum,
);
// A regular tool-cache entry may have been verified using a manifest checksum.
toolCacheName = `${TOOL_CACHE_NAME}-${checksum}`;
}
const toolCacheResult = tryGetFromToolCache(
arch,
resolvedVersion,
toolCacheName,
);
if (toolCacheResult.installedPath) { if (toolCacheResult.installedPath) {
log.info(`Found uv in tool-cache for ${toolCacheResult.version}`); log.info(`Found uv in tool-cache for ${toolCacheResult.version}`);
return { return {
@@ -160,10 +179,11 @@ async function setupUv(
platform, platform,
arch, arch,
resolvedVersion, resolvedVersion,
inputs.checksum, checksum,
inputs.githubToken, inputs.githubToken,
inputs.manifestFile, inputs.manifestFile,
inputs.downloadFromAstralMirror, inputs.downloadFromAstralMirror,
toolCacheName,
); );
return { return {
+3
View File
@@ -30,6 +30,7 @@ export interface SetupInputs {
noProject: boolean; noProject: boolean;
venvPath: string; venvPath: string;
checksum: string; checksum: string;
requireChecksums: boolean;
enableCache: boolean; enableCache: boolean;
restoreCache: boolean; restoreCache: boolean;
saveCache: boolean; saveCache: boolean;
@@ -63,6 +64,7 @@ export function loadInputs(): SetupInputs {
const noProject = core.getBooleanInput("no-project"); const noProject = core.getBooleanInput("no-project");
const venvPath = getVenvPath(workingDirectory, activateEnvironment); const venvPath = getVenvPath(workingDirectory, activateEnvironment);
const checksum = core.getInput("checksum"); const checksum = core.getInput("checksum");
const requireChecksums = core.getBooleanInput("require-checksums");
const enableCache = getEnableCache(); const enableCache = getEnableCache();
const restoreCache = core.getInput("restore-cache") === "true"; const restoreCache = core.getInput("restore-cache") === "true";
const saveCache = getSaveCache(); const saveCache = getSaveCache();
@@ -110,6 +112,7 @@ export function loadInputs(): SetupInputs {
pythonDir, pythonDir,
pythonVersion, pythonVersion,
quiet, quiet,
requireChecksums,
resolutionStrategy, resolutionStrategy,
restoreCache, restoreCache,
saveCache, saveCache,