Set up your GitHub Actions workflow with a specific version of https://docs.astral.sh/uv/
Go to file
dependabot[bot] 6343f7c79b
Bump eslint-plugin-github from 5.0.1 to 5.0.2 (#69)
Bumps
[eslint-plugin-github](https://github.com/github/eslint-plugin-github)
from 5.0.1 to 5.0.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/github/eslint-plugin-github/releases">eslint-plugin-github's
releases</a>.</em></p>
<blockquote>
<h2>v5.0.2</h2>
<h2>What's Changed</h2>
<ul>
<li>chore(deps): bump the all-dependencies group across 1 directory with
3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/533">github/eslint-plugin-github#533</a></li>
<li>chore(deps): bump braces from 3.0.2 to 3.0.3 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/534">github/eslint-plugin-github#534</a></li>
<li>chore(deps): bump the all-dependencies group with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/535">github/eslint-plugin-github#535</a></li>
<li>chore(deps): bump the all-dependencies group with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/536">github/eslint-plugin-github#536</a></li>
<li>chore(deps): bump the all-dependencies group with 4 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/537">github/eslint-plugin-github#537</a></li>
<li>chore(deps): bump the all-dependencies group with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/538">github/eslint-plugin-github#538</a></li>
<li>chore(deps): bump the all-dependencies group with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/540">github/eslint-plugin-github#540</a></li>
<li>chore(deps): bump the all-dependencies group with 4 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/541">github/eslint-plugin-github#541</a></li>
<li>chore(deps): bump the all-dependencies group across 1 directory with
3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/543">github/eslint-plugin-github#543</a></li>
<li>chore(deps): bump the all-dependencies group with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/544">github/eslint-plugin-github#544</a></li>
<li>chore(deps): bump the all-dependencies group with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/545">github/eslint-plugin-github#545</a></li>
<li>chore(deps): bump the all-dependencies group across 1 directory with
4 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/github/eslint-plugin-github/pull/551">github/eslint-plugin-github#551</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/github/eslint-plugin-github/compare/v5.0.1...v5.0.2">https://github.com/github/eslint-plugin-github/compare/v5.0.1...v5.0.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d6f656d78f"><code>d6f656d</code></a>
Merge pull request <a
href="https://redirect.github.com/github/eslint-plugin-github/issues/551">#551</a>
from github/dependabot/npm_and_yarn/all-dependencies-...</li>
<li><a
href="df2c60a624"><code>df2c60a</code></a>
chore(deps): bump the all-dependencies group across 1 directory with 4
updates</li>
<li><a
href="0f0979cb38"><code>0f0979c</code></a>
chore(deps): bump the all-dependencies group with 3 updates (<a
href="https://redirect.github.com/github/eslint-plugin-github/issues/545">#545</a>)</li>
<li><a
href="0e294e5c4d"><code>0e294e5</code></a>
Merge pull request <a
href="https://redirect.github.com/github/eslint-plugin-github/issues/544">#544</a>
from github/dependabot/npm_and_yarn/all-dependencies-...</li>
<li><a
href="17c6e39aa4"><code>17c6e39</code></a>
chore(deps): bump the all-dependencies group with 3 updates</li>
<li><a
href="86d5cb1324"><code>86d5cb1</code></a>
Merge pull request <a
href="https://redirect.github.com/github/eslint-plugin-github/issues/543">#543</a>
from github/dependabot/npm_and_yarn/all-dependencies-...</li>
<li><a
href="522309f8d0"><code>522309f</code></a>
chore(deps): bump the all-dependencies group across 1 directory with 3
updates</li>
<li><a
href="c3857ba01e"><code>c3857ba</code></a>
Merge pull request <a
href="https://redirect.github.com/github/eslint-plugin-github/issues/541">#541</a>
from github/dependabot/npm_and_yarn/all-dependencies-...</li>
<li><a
href="8010f55226"><code>8010f55</code></a>
chore(deps): bump the all-dependencies group with 4 updates</li>
<li><a
href="777227525b"><code>7772275</code></a>
Merge pull request <a
href="https://redirect.github.com/github/eslint-plugin-github/issues/540">#540</a>
from github/dependabot/npm_and_yarn/all-dependencies-...</li>
<li>Additional commits viewable in <a
href="https://github.com/github/eslint-plugin-github/compare/v5.0.1...v5.0.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint-plugin-github&package-manager=npm_and_yarn&previous-version=5.0.1&new-version=5.0.2)](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 merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@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>
2024-09-16 21:12:54 +02:00
__tests__ Do not change default version on known checksum update (#39) 2024-09-05 13:26:17 +00:00
.github Bump peter-evans/create-pull-request from 7.0.2 to 7.0.3 (#75) 2024-09-16 14:53:59 +02:00
dist chore: update known checksums for 0.4.10 (#72) 2024-09-13 19:15:03 +00:00
src chore: update known checksums for 0.4.10 (#72) 2024-09-13 19:15:03 +00:00
.editorconfig Change Prettier settings (#36) 2024-09-05 08:06:45 -04:00
.eslintignore Initial commit 2024-08-23 23:58:26 +02:00
.eslintrc.json Change Prettier settings (#36) 2024-09-05 08:06:45 -04:00
.gitattributes Change Prettier settings (#36) 2024-09-05 08:06:45 -04:00
.gitignore Add .idea files to gitignore (#76) 2024-09-16 13:05:47 +00:00
.prettierignore Initial commit 2024-08-23 23:58:26 +02:00
.prettierrc.json Change Prettier settings (#36) 2024-09-05 08:06:45 -04:00
action.yml Set the cache-dependency-glob default to **/uv.lock (#77) 2024-09-16 21:08:44 +02:00
CODEOWNERS Initial commit 2024-08-23 23:58:26 +02:00
jest.config.js Change Prettier settings (#36) 2024-09-05 08:06:45 -04:00
LICENSE Initial commit 2024-08-23 23:58:26 +02:00
package-lock.json Bump eslint-plugin-github from 5.0.1 to 5.0.2 (#69) 2024-09-16 21:12:54 +02:00
package.json Bump eslint-plugin-github from 5.0.1 to 5.0.2 (#69) 2024-09-16 21:12:54 +02:00
README.md Set the cache-dependency-glob default to **/uv.lock (#77) 2024-09-16 21:08:44 +02:00
tsconfig.json Run Prettier over Markdown and YAML files (#35) 2024-09-04 21:14:10 +00:00

setup-uv

Set up your GitHub Actions workflow with a specific version of uv.

  • Install a version of uv and add it to PATH
  • Cache the installed version of uv to speed up consecutive runs on self-hosted runners
  • Register problem matchers for error output
  • (Optional) Persist the uv's cache in the GitHub Actions Cache
  • (Optional) Verify the checksum of the downloaded uv executable

Contents

Usage

Install the latest version (default)

- name: Install the latest version of uv
  uses: astral-sh/setup-uv@v2
  with:
    version: "latest"

For an example workflow, see here.

Tip

Using latest requires that uv download the executable on every run, which incurs a cost (especially on self-hosted runners). As a best practice, consider pinning the version to a specific release.

Install a specific version

- name: Install a specific version of uv
  uses: astral-sh/setup-uv@v2
  with:
    version: "0.4.4"

Validate checksum

You can also specify a checksum to validate the downloaded file. Checksums up to the default version are automatically verified by this action. The sha265 hashes can be found on the releases page of the uv repo.

- name: Install a specific version and validate the checksum
  uses: astral-sh/setup-uv@v2
  with:
    version: "0.3.1"
    checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"

Enable caching

If you enable caching, the uv cache will be cached to the GitHub Actions Cache. This can speed up runs that reuse the cache by several minutes.

Tip

On self-hosted runners this is usually not needed since the cache generated by uv on the runner's filesystem is not removed after a run. For more details see Local cache path.

You can optionally define a custom cache key suffix.

- name: Enable caching and define a custom cache key suffix
  id: setup-uv
  uses: astral-sh/setup-uv@v2
  with:
    enable-cache: true
    cache-suffix: "optional-suffix"

When the cache was successfully restored, the output cache-hit will be set to true and you can use it in subsequent steps. For example, to use the cache in the above case:

- name: Do something if the cache was restored
  if: steps.setup-uv.outputs.cache-hit == 'true'
  run: echo "Cache was restored"

Cache dependency glob

If you want to control when the cache is invalidated, specify a glob pattern with the cache-dependency-glob input. The cache will be invalidated if any file matching the glob pattern changes. The glob matches files relative to the repository root.

Note

The default is **/uv.lock.

- name: Define a cache dependency glob
  uses: astral-sh/setup-uv@v2
  with:
    enable-cache: true
    cache-dependency-glob: "**/requirements*.txt"
- name: Define a list of cache dependency globs
  uses: astral-sh/setup-uv@v2
  with:
    enable-cache: true
    cache-dependency-glob: |
      **/requirements*.txt
      **/pyproject.toml      
- name: Never invalidate the cache
  uses: astral-sh/setup-uv@v2
  with:
    enable-cache: true
    cache-dependency-glob: ""

Local cache path

This action controls where uv stores its cache on the runner's filesystem. You can change the default (/tmp/setup-uv-cache) by specifying the path with the cache-local-path input.

- name: Define a custom uv cache path
  uses: astral-sh/setup-uv@v2
  with:
    cache-local-path: "/path/to/cache"

GitHub authentication token

This action uses the GitHub API to fetch the uv release artifacts. To avoid hitting the GitHub API rate limit too quickly, an authentication token can be provided via the github-token input. By default, the GITHUB_TOKEN secret is used, which is automatically provided by GitHub Actions.

If the default permissions for the GitHub token are not sufficient, you can provide a custom GitHub token with the necessary permissions.

- name: Install the latest version of uv with a custom GitHub token
  uses: astral-sh/setup-uv@v2
  with:
    github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}

How it works

This action downloads uv from the uv repo's official GitHub Releases and uses the GitHub Actions Toolkit to cache it as a tool to speed up consecutive runs on self-hosted runners.

The installed version of uv is then added to the runner PATH, enabling subsequent steps to invoke it by name (uv).

FAQ

Do I still need actions/setup-python alongside setup-uv?

No. This action is modelled as a drop-in replacement for actions/setup-python when using uv. With setup-uv, you can install a specific version of Python using uv python install rather than relying on actions/setup-python.

For example:

- name: Checkout the repository
  uses: actions/checkout@main
- name: Install the latest version of uv
  uses: astral-sh/setup-uv@v2
  with:
    enable-cache: true
- name: Test
  run: uv run --frozen pytest

To install a specific version of Python, use uv python install:

- name: Install the latest version of uv
  uses: astral-sh/setup-uv@v2
  with:
    enable-cache: true
- name: Install Python 3.12
  run: uv python install 3.12

What is the default version?

By default, this action installs the latest version of uv.

If you require the installed version in subsequent steps of your workflow, use the uv-version output:

- name: Checkout the repository
  uses: actions/checkout@main
- name: Install the default version of uv
  id: setup-uv
  uses: astral-sh/setup-uv@v2
- name: Print the installed version
  run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"

Acknowledgements

setup-uv was initially written and published by Kevin Stillhammer before moving under the official Astral GitHub organization. You can support Kevin's work in open source on Buy me a coffee or PayPal.

License

MIT