Merge branch 'main' into dependabot/npm_and_yarn/actions/glob-0.5.0

This commit is contained in:
Charlie Marsh 2024-09-05 09:31:54 -04:00
commit f0d5554732
43 changed files with 40767 additions and 5460 deletions

20
.editorconfig Normal file
View file

@ -0,0 +1,20 @@
# Check http://editorconfig.org for more information
# This is the main config file for this project:
root = true
[*]
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
indent_style = space
insert_final_newline = true
indent_size = 2
[*.{rs,py,pyi}]
indent_size = 4
[*.snap]
trim_trailing_whitespace = false
[*.md]
max_line_length = 100

View file

@ -15,14 +15,20 @@
"import/no-namespace": "off", "import/no-namespace": "off",
"no-unused-vars": "off", "no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}], "@typescript-eslint/explicit-member-accessibility": [
"error",
{ "accessibility": "no-public" }
],
"@typescript-eslint/no-require-imports": "error", "@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error", "@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error", "@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error", "@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off", "camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error", "@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}], "@typescript-eslint/explicit-function-return-type": [
"error",
{ "allowExpressions": true }
],
"@typescript-eslint/func-call-spacing": ["error", "never"], "@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error", "@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-empty-interface": "error",
@ -44,8 +50,6 @@
"@typescript-eslint/promise-function-async": "error", "@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error", "@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error", "@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error", "@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error" "@typescript-eslint/unbound-method": "error"
}, },
@ -54,4 +58,4 @@
"es6": true, "es6": true,
"jest/globals": true "jest/globals": true
} }
} }

View file

@ -1,5 +1,5 @@
name-template: 'v$RESOLVED_VERSION 🌈' name-template: "v$RESOLVED_VERSION 🌈"
tag-template: 'v$RESOLVED_VERSION' tag-template: "v$RESOLVED_VERSION"
categories: categories:
- title: "🚨 Breaking changes" - title: "🚨 Breaking changes"
labels: labels:
@ -19,28 +19,30 @@ categories:
labels: labels:
- "maintenance" - "maintenance"
- "ci" - "ci"
- "update-known-checksums"
- title: "📚 Documentation" - title: "📚 Documentation"
labels: labels:
- "documentation" - "documentation"
- title: "⬆️ Dependency updates" - title: "⬆️ Dependency updates"
labels: labels:
- "dependencies" - "dependencies"
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver: version-resolver:
major: major:
labels: labels:
- 'major' - "major"
- 'breaking-change' - "breaking-change"
minor: minor:
labels: labels:
- 'minor' - "minor"
- 'new-feature' - "new-feature"
- 'enhancement' - "enhancement"
patch: patch:
labels: labels:
- 'patch' - "patch"
- 'bugfix' - "bugfix"
- "default-version-update"
default: patch default: patch
template: | template: |
## Changes ## Changes

View file

@ -10,10 +10,10 @@ on:
branches: branches:
- main - main
paths-ignore: paths-ignore:
- '**.md' - "**.md"
pull_request: pull_request:
paths-ignore: paths-ignore:
- '**.md' - "**.md"
workflow_dispatch: workflow_dispatch:
jobs: jobs:

View file

@ -13,12 +13,12 @@ name: "CodeQL"
on: on:
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
# The branches below must be a subset of the branches above # The branches below must be a subset of the branches above
branches: [ main ] branches: [main]
schedule: schedule:
- cron: '31 7 * * 3' - cron: "31 7 * * 3"
jobs: jobs:
analyze: analyze:
@ -32,7 +32,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'TypeScript' ] language: ["TypeScript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support # Learn more about CodeQL language support at https://git.io/codeql-language-support

View file

@ -1,4 +1,4 @@
name: 'test-cache-windows' name: "test-cache-windows"
on: on:
pull_request: pull_request:
push: push:

View file

@ -1,4 +1,4 @@
name: 'test-cache' name: "test-cache"
on: on:
pull_request: pull_request:
push: push:

View file

@ -1,4 +1,4 @@
name: 'test-windows' name: "test-windows"
on: on:
pull_request: pull_request:
push: push:

View file

@ -1,4 +1,4 @@
name: 'test' name: "test"
on: on:
pull_request: pull_request:
push: push:
@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: "20"
- run: | - run: |
npm install npm install
- run: | - run: |
@ -42,7 +42,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, macos-14, oracle-aarch64] os: [ubuntu-latest, macos-latest, macos-14, oracle-aarch64]
uv-version: ['latest','0.3.0','0.3.2'] uv-version: ["latest", "0.3.0", "0.3.2"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install version ${{ matrix.uv-version }} - name: Install version ${{ matrix.uv-version }}
@ -57,19 +57,20 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, oracle-aarch64] os: [ubuntu-latest, oracle-aarch64]
checksum: ['4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd'] checksum:
["4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd"]
exclude: exclude:
- os: oracle-aarch64 - os: oracle-aarch64
checksum: '4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd' checksum: "4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd"
include: include:
- os: oracle-aarch64 - os: oracle-aarch64
checksum: 'e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8' checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Checksum matches expected - name: Checksum matches expected
uses: ./ uses: ./
with: with:
version: '0.3.2' version: "0.3.2"
checksum: ${{ matrix.checksum }} checksum: ${{ matrix.checksum }}
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
test-without-github-token: test-without-github-token:

View file

@ -1,26 +0,0 @@
name: 'Update default version and checksums'
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Update default version and checksums
id: update-default-version
run: node dist/update-default-version/index.js src/download/checksum/known-checksums.ts action.yml ${{ secrets.GITHUB_TOKEN }}
- run: npm install && npm run all
- name: Create Pull Request
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
commit-message: "chore: update checksums"
title: "chore: update default version to ${{ steps.update-default-version.outputs.latest-version }}"
body: "chore: update default version to ${{ steps.update-default-version.outputs.latest-version }}"
base: main
labels: "automated-pr,bugfix"
branch: update-default-version-pr
delete-branch: true

View file

@ -0,0 +1,32 @@
name: "Update known checksums"
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Update known checksums
id: update-known-checksums
run:
node dist/update-known-checksums/index.js
src/download/checksum/known-checksums.ts ${{ secrets.GITHUB_TOKEN }}
- run: npm install && npm run all
- name: Create Pull Request
uses: peter-evans/create-pull-request@4320041ed380b20e97d388d56a7fb4f9b8c20e79 # v7.0.0
with:
commit-message: "chore: update known checksums"
title:
"chore: update known checksums for ${{
steps.update-known-checksums.outputs.latest-version }}"
body:
"chore: update known checksums for ${{
steps.update-known-checksums.outputs.latest-version }}"
base: main
labels: "automated-pr,update-known-checksums"
branch: update-known-checksums-pr
delete-branch: true

View file

@ -5,9 +5,9 @@ name: Update Major Minor Tags
on: on:
push: push:
branches-ignore: branches-ignore:
- '**' - "**"
tags: tags:
- 'v*.*.*' - "v*.*.*"
jobs: jobs:
update_major_minor_tags: update_major_minor_tags:

View file

@ -1,10 +1,4 @@
{ {
"printWidth": 80, "trailingComma": "all",
"tabWidth": 2, "proseWrap": "always"
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid"
} }

166
README.md
View file

@ -2,92 +2,85 @@
Set up your GitHub Actions workflow with a specific version of [uv](https://docs.astral.sh/uv/). Set up your GitHub Actions workflow with a specific version of [uv](https://docs.astral.sh/uv/).
* Install a version of uv and add it to the path - 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 - 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: Cache the uv cache - (Optional) Persist the uv's cache in the GitHub Actions Cache
* Optional: Verify the checksum of the downloaded uv executable - (Optional) Verify the checksum of the downloaded uv executable
## Contents ## Contents
* [Usage](#usage) - [Usage](#usage)
* [Install specific version](#install-specific-version) - [Install specific version](#install-specific-version)
* [Install latest version](#install-latest-version) - [Install latest version](#install-latest-version)
* [Validate checksum](#validate-checksum) - [Validate checksum](#validate-checksum)
* [Enable Caching](#enable-caching) - [Enable Caching](#enable-caching)
* [Local cache path](#local-cache-path) - [Local cache path](#local-cache-path)
* [Cache dependency glob](#cache-dependency-glob) - [Cache dependency glob](#cache-dependency-glob)
* [API rate limit](#api-rate-limit) - [API rate limit](#api-rate-limit)
* [How it works](#how-it-works) - [How it works](#how-it-works)
* [FAQ](#faq) - [FAQ](#faq)
## Usage ## Usage
Example workflow in a real world project can be found [here](https://github.com/eifinger/hass-weenect/blob/main/.github/workflows/ci.yml) Example workflow in a real world project can be found
[here](https://github.com/eifinger/hass-weenect/blob/main/.github/workflows/ci.yml)
### Install specific version ### Install the latest version (default)
You can also specify a specific version of uv
```yaml ```yaml
- name: Install a specific version - name: Install the latest version of uv
uses: eifinger/setup-uv@v1 uses: astral-sh/setup-uv@v1
with: with:
version: '0.3.0' version: "latest"
``` ```
### Install latest version > [!TIP] Using `latest` requires that uv download the executable on every run, which incurs a cost
> (especially on self-hosted runners). As an alternative, consider pinning the version to a specific
> release.
By default this action installs the version defined as `default` in `action.yml`. ### Install a specific version
This gets automatically updated in a new release of this action when a new version of uv is released.
If you don't want to wait for a new release of this action you can use use `version: latest`.
> [!WARNING]
> Using the `latest` version means that the uv executable gets downloaded every single time instead of loaded from the tools cache.
> This can take up to 20s depending on the download speed.
> This does not affect the uv cache.
```yaml ```yaml
- name: Install a specific version - name: Install a specific version of uv
uses: eifinger/setup-uv@v1 uses: astral-sh/setup-uv@v1
with: with:
version: 'latest' version: "0.4.4"
``` ```
### Validate checksum ### Validate checksum
You can also specify a checksum to validate the downloaded file. You can also specify a checksum to validate the downloaded file. Checksums up to the default version
Checksums up to the default version are automatically verified by this action. are automatically verified by this action. The sha265 hashes can be found on the
The sha265 hashes can be found on the [releases page](https://github.com/astral-sh/uv/releases) [releases page](https://github.com/astral-sh/uv/releases) of the uv repo.
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: eifinger/setup-uv@v1 uses: astral-sh/setup-uv@v1
with: with:
version: '0.3.1' version: "0.3.1"
checksum: 'e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8' checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
``` ```
### Enable caching ### Enable caching
If you enable caching the [uv cache](https://docs.astral.sh/uv/concepts/cache/) will If you enable caching, the [uv cache](https://docs.astral.sh/uv/concepts/cache/) will be cached to
be cached to the GitHub Actions Cache. This can speed up runs which can reuse the cache the GitHub Actions Cache. This can speed up runs that reuse the cache by several minutes. The cache
by several minutes. The cache will always be reused on self-hosted runners. will always be reused on self-hosted runners.
You can optionally define a custom cache key suffix. 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: eifinger/setup-uv@v1 uses: astral-sh/setup-uv@v1
with: with:
enable-cache: true enable-cache: true
cache-suffix: 'optional-suffix' 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. When the cache was successfully restored, the output `cache-hit` will be set to `true` and you can
For the example above you can use it like this: use it in subsequent steps. For example, to use the cache in the above case:
```yaml ```yaml
- name: Do something if the cache was restored - name: Do something if the cache was restored
@ -97,55 +90,60 @@ For the example above you can use it like this:
#### Local cache path #### Local cache path
If you want to save the cache to a local path other than the default path (`/tmp/setup-uv-cache`) If you want to save the cache to a local path other than the default path (`/tmp/setup-uv-cache`),
you can specify the path with the `cache-local-path` input. specify the path with the `cache-local-path` input.
```yaml ```yaml
- name: Define a custom uv cache path - name: Define a custom uv cache path
uses: eifinger/setup-uv@v1 uses: astral-sh/setup-uv@v1
with: with:
enable-cache: true enable-cache: true
cache-local-path: '/path/to/cache' cache-local-path: "/path/to/cache"
``` ```
#### Cache dependency glob #### Cache dependency glob
If you want to control when the cache is invalidated you can specify a glob pattern with the `cache-dependency-glob` input. If you want to control when the cache is invalidated, specify a glob pattern with the
The cache will be invalidated if any file matching the glob pattern changes. `cache-dependency-glob` input. The cache will be invalidated if any file matching the glob pattern
The glob matches files relative to the repository root. changes. The glob matches files relative to the repository root.
```yaml ```yaml
- name: Define a cache dependency glob - name: Define a cache dependency glob
uses: eifinger/setup-uv@v1 uses: astral-sh/setup-uv@v1
with: with:
enable-cache: true enable-cache: true
cache-dependency-glob: 'uv.lock' cache-dependency-glob: "uv.lock"
``` ```
```yaml ```yaml
- name: Define a cache dependency glob - name: Define a cache dependency glob
uses: eifinger/setup-uv@v1 uses: astral-sh/setup-uv@v1
with: with:
enable-cache: true enable-cache: true
cache-dependency-glob: '**requirements*.txt' cache-dependency-glob: "**requirements*.txt"
``` ```
### API rate limit ### API rate limit
To avoid hitting the error `API rate limit exceeded` you can supply a GitHub token with the `github-token` input. To avoid hitting the error `API rate limit exceeded`, supply a GitHub token with the `github-token`
input.
```yaml ```yaml
- name: Install uv and supply a GitHub token - name: Install uv and supply a GitHub token
uses: eifinger/setup-uv@v1 uses: astral-sh/setup-uv@v1
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
``` ```
## How it works ## How it works
This action downloads uv from the releases of the [uv repo](https://github.com/astral-sh/uv) and uses the [GitHub Actions Toolkit](https://github.com/actions/toolkit) to cache it as a tool to speed up consecutive runs on self-hosted runners. This action downloads uv from the uv repo's official
[GitHub Releases](https://github.com/astral-sh/uv) and uses the
[GitHub Actions Toolkit](https://github.com/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 so other steps can just use it by calling `uv`. The installed version of uv is then added to the runner PATH, enabling subsequent steps to invoke it
by name (`uv`).
## FAQ ## FAQ
@ -153,37 +151,61 @@ The installed version of uv is then added to the runner path so other steps can
No! This action was modelled as a drop-in replacement for `actions/setup-python` when using uv. No! This action was modelled as a drop-in replacement for `actions/setup-python` when using uv.
A simple example workflow could look like this: For example:
```yaml ```yaml
- 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: eifinger/setup-uv@v1 uses: astral-sh/setup-uv@v1
with: with:
enable-cache: true enable-cache: true
- name: Test - name: Test
run: uv run --frozen pytest run: uv run --frozen pytest
``` ```
To install a specific version of Python, use
[`uv python install`](https://docs.astral.sh/uv/guides/install-python/):
```yaml
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v1
with:
enable-cache: true
- name: Install Python 3.12
run: uv python install 3.12
```
### What is the default version? ### What is the default version?
By default this action installs the version defined as `default` in `action.yml`. By default, this action installs the latest version of uv.
When a new release of uv is published this triggers an automatic release of this action with the new version as `default`.
If you have to know the version installed for other steps of your workflow you can use the `uv-version` output: If you require the installed version in subsequent steps of your workflow, use the `uv-version`
output:
```yaml ```yaml
- name: Checkout the repository - name: Checkout the repository
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: eifinger/setup-uv@v1 uses: astral-sh/setup-uv@v1
- 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 }}"
``` ```
--- ## Acknowledgements
[<img src="https://raw.githubusercontent.com/eifinger/setup-uv/main/docs/images/bmc-button.svg" width=150 height=40 style="margin: 5px"/>](https://www.buymeacoffee.com/eifinger) `setup-uv` was initially written and published by [Kevin Stillhammer](https://github.com/eifinger)
[<img src="https://raw.githubusercontent.com/eifinger/setup-uv/main/docs/images/paypal-button.svg" width=150 height=40 style="margin: 5px"/>](https://paypal.me/kevinstillhammer) before moving under the official [Astral](https://github.com/astral-sh) GitHub organization. You can
support Kevin's work in open source on [Buy me a coffee](https://www.buymeacoffee.com/eifinger) or
[PayPal](https://paypal.me/kevinstillhammer).
## License
MIT
<div align="center">
<a target="_blank" href="https://astral.sh" style="background:none">
<img src="https://raw.githubusercontent.com/astral-sh/uv/main/assets/svg/Astral.svg" alt="Made by Astral">
</a>
</div>

View file

@ -1,37 +0,0 @@
import {expect, test, it} from '@jest/globals'
import {
isknownVersion,
validateChecksum
} from '../../../src/download/checksum/checksum'
test('checksum should match', async () => {
const validChecksum =
'f3da96ec7e995debee7f5d52ecd034dfb7074309a1da42f76429ecb814d813a3'
const filePath = '__tests__/fixtures/checksumfile'
// string params don't matter only test the checksum mechanism, not known checksums
await validateChecksum(
validChecksum,
filePath,
'aarch64',
'pc-windows-msvc',
'1.2.3'
)
})
type KnownVersionFixture = {version: string; known: boolean}
it.each<KnownVersionFixture>([
{
version: '0.3.0',
known: true
},
{
version: '0.0.15',
known: false
}
])(
'isknownVersion should return $known for version $version',
({version, known}) => {
expect(isknownVersion(version)).toBe(known)
}
)

View file

@ -0,0 +1,37 @@
import { expect, test, it } from "@jest/globals";
import {
isknownVersion,
validateChecksum,
} from "../../../src/download/checksum/checksum";
test("checksum should match", async () => {
const validChecksum =
"f3da96ec7e995debee7f5d52ecd034dfb7074309a1da42f76429ecb814d813a3";
const filePath = "__tests__/fixtures/checksumfile";
// string params don't matter only test the checksum mechanism, not known checksums
await validateChecksum(
validChecksum,
filePath,
"aarch64",
"pc-windows-msvc",
"1.2.3",
);
});
type KnownVersionFixture = { version: string; known: boolean };
it.each<KnownVersionFixture>([
{
version: "0.3.0",
known: true,
},
{
version: "0.0.15",
known: false,
},
])(
"isknownVersion should return $known for version $version",
({ version, known }) => {
expect(isknownVersion(version)).toBe(known);
},
);

View file

@ -1,38 +1,42 @@
name: 'Python setup uv' name: "Python setup uv"
description: 'Set up your GitHub Actions workflow with a specific version of uv' description: "Set up your GitHub Actions workflow with a specific version of uv"
author: 'eifinger' author: "eifinger"
inputs: inputs:
version: version:
description: 'The version of uv to install' description: "The version of uv to install"
default: '0.3.3' default: "latest"
checksum: checksum:
description: 'The checksum of the uv version to install' description: "The checksum of the uv version to install"
required: false required: false
github-token: github-token:
description: 'Used to increase the rate limit when retrieving versions and downloading uv.' description:
"Used to increase the rate limit when retrieving versions and downloading
uv."
required: false required: false
enable-cache: enable-cache:
description: 'Enable caching of the uv cache' description: "Enable caching of the uv cache"
default: 'false' default: "false"
cache-dependency-glob: cache-dependency-glob:
description: 'Glob pattern to match files relative to the repository root to control the cache. e.g. "uv.lock"' description:
'Glob pattern to match files relative to the repository root to control
the cache. e.g. "uv.lock"'
required: false required: false
cache-suffix: cache-suffix:
description: 'Suffix for the cache key' description: "Suffix for the cache key"
required: false required: false
cache-local-path: cache-local-path:
description: 'Local path to store the cache.' description: "Local path to store the cache."
default: '/tmp/setup-uv-cache' default: "/tmp/setup-uv-cache"
outputs: outputs:
uv-version: uv-version:
description: "The installed uv version. Useful when using latest." description: "The installed uv version. Useful when using latest."
cache-hit: cache-hit:
description: "A boolean value to indicate a cache entry was found" description: "A boolean value to indicate a cache entry was found"
runs: runs:
using: 'node20' using: "node20"
main: 'dist/setup/index.js' main: "dist/setup/index.js"
post: 'dist/save-cache/index.js' post: "dist/save-cache/index.js"
post-if: success() post-if: success()
branding: branding:
icon: 'package' icon: "package"
color: 'blue' color: "blue"

72
dist/save-cache/index.js generated vendored
View file

@ -82788,16 +82788,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.restoreCache = exports.STATE_CACHE_MATCHED_KEY = exports.STATE_CACHE_KEY = void 0; exports.STATE_CACHE_MATCHED_KEY = exports.STATE_CACHE_KEY = void 0;
exports.restoreCache = restoreCache;
const cache = __importStar(__nccwpck_require__(7799)); const cache = __importStar(__nccwpck_require__(7799));
const glob = __importStar(__nccwpck_require__(8090)); const glob = __importStar(__nccwpck_require__(8090));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const path_1 = __importDefault(__nccwpck_require__(1017)); const path_1 = __importDefault(__nccwpck_require__(1017));
const inputs_1 = __nccwpck_require__(9378); const inputs_1 = __nccwpck_require__(9378);
const platforms_1 = __nccwpck_require__(6005); const platforms_1 = __nccwpck_require__(6005);
exports.STATE_CACHE_KEY = 'cache-key'; exports.STATE_CACHE_KEY = "cache-key";
exports.STATE_CACHE_MATCHED_KEY = 'cache-matched-key'; exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
const CACHE_VERSION = '1'; const CACHE_VERSION = "1";
function restoreCache(version) { function restoreCache(version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const cacheKey = yield computeKeys(version); const cacheKey = yield computeKeys(version);
@ -82809,40 +82810,39 @@ function restoreCache(version) {
catch (err) { catch (err) {
const message = err.message; const message = err.message;
core.warning(message); core.warning(message);
core.setOutput('cache-hit', false); core.setOutput("cache-hit", false);
return; return;
} }
core.saveState(exports.STATE_CACHE_KEY, cacheKey); core.saveState(exports.STATE_CACHE_KEY, cacheKey);
handleMatchResult(matchedKey, cacheKey); handleMatchResult(matchedKey, cacheKey);
}); });
} }
exports.restoreCache = restoreCache;
function computeKeys(version) { function computeKeys(version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let cacheDependencyPathHash = '-'; let cacheDependencyPathHash = "-";
if (inputs_1.cacheDependencyGlob !== '') { if (inputs_1.cacheDependencyGlob !== "") {
const fullCacheDependencyGlob = `${process.env['GITHUB_WORKSPACE']}${path_1.default.sep}${inputs_1.cacheDependencyGlob}`; const fullCacheDependencyGlob = `${process.env["GITHUB_WORKSPACE"]}${path_1.default.sep}${inputs_1.cacheDependencyGlob}`;
cacheDependencyPathHash += yield glob.hashFiles(fullCacheDependencyGlob); cacheDependencyPathHash += yield glob.hashFiles(fullCacheDependencyGlob);
if (cacheDependencyPathHash === '-') { if (cacheDependencyPathHash === "-") {
throw new Error(`No file in ${process.cwd()} matched to [${inputs_1.cacheDependencyGlob}], make sure you have checked out the target repository`); throw new Error(`No file in ${process.cwd()} matched to [${inputs_1.cacheDependencyGlob}], make sure you have checked out the target repository`);
} }
} }
else { else {
cacheDependencyPathHash += 'no-dependency-glob'; cacheDependencyPathHash += "no-dependency-glob";
} }
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : ''; const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : "";
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${version}${cacheDependencyPathHash}${suffix}`; return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${version}${cacheDependencyPathHash}${suffix}`;
}); });
} }
function handleMatchResult(matchedKey, primaryKey) { function handleMatchResult(matchedKey, primaryKey) {
if (!matchedKey) { if (!matchedKey) {
core.info(`No GitHub Actions cache found for key: ${primaryKey}`); core.info(`No GitHub Actions cache found for key: ${primaryKey}`);
core.setOutput('cache-hit', false); core.setOutput("cache-hit", false);
return; return;
} }
core.saveState(exports.STATE_CACHE_MATCHED_KEY, matchedKey); core.saveState(exports.STATE_CACHE_MATCHED_KEY, matchedKey);
core.info(`uv cache restored from GitHub Actions cache with key: ${matchedKey}`); core.info(`uv cache restored from GitHub Actions cache with key: ${matchedKey}`);
core.setOutput('cache-hit', true); core.setOutput("cache-hit", true);
} }
@ -82886,7 +82886,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = void 0; exports.run = run;
const cache = __importStar(__nccwpck_require__(7799)); const cache = __importStar(__nccwpck_require__(7799));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
@ -82906,13 +82906,12 @@ function run() {
process.exit(0); process.exit(0);
}); });
} }
exports.run = run;
function saveCache() { function saveCache() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const cacheKey = core.getState(restore_cache_1.STATE_CACHE_KEY); const cacheKey = core.getState(restore_cache_1.STATE_CACHE_KEY);
const matchedKey = core.getState(restore_cache_1.STATE_CACHE_MATCHED_KEY); const matchedKey = core.getState(restore_cache_1.STATE_CACHE_MATCHED_KEY);
if (!cacheKey) { if (!cacheKey) {
core.warning('Error retrieving cache key from state.'); core.warning("Error retrieving cache key from state.");
return; return;
} }
else if (matchedKey === cacheKey) { else if (matchedKey === cacheKey) {
@ -82928,11 +82927,11 @@ function saveCache() {
function pruneCache() { function pruneCache() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const options = { const options = {
silent: !core.isDebug() silent: !core.isDebug(),
}; };
const execArgs = ['cache', 'prune', '--ci']; const execArgs = ["cache", "prune", "--ci"];
core.info('Pruning cache...'); core.info("Pruning cache...");
yield exec.exec('uv', execArgs, options); yield exec.exec("uv", execArgs, options);
}); });
} }
run(); run();
@ -82971,13 +82970,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.cacheDependencyGlob = exports.githubToken = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0; exports.cacheDependencyGlob = exports.githubToken = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
exports.version = core.getInput('version'); exports.version = core.getInput("version");
exports.checkSum = core.getInput('checksum'); exports.checkSum = core.getInput("checksum");
exports.enableCache = core.getInput('enable-cache') === 'true'; exports.enableCache = core.getInput("enable-cache") === "true";
exports.cacheSuffix = core.getInput('cache-suffix') || ''; exports.cacheSuffix = core.getInput("cache-suffix") || "";
exports.cacheLocalPath = core.getInput('cache-local-path'); exports.cacheLocalPath = core.getInput("cache-local-path");
exports.githubToken = core.getInput('github-token'); exports.githubToken = core.getInput("github-token");
exports.cacheDependencyGlob = core.getInput('cache-dependency-glob'); exports.cacheDependencyGlob = core.getInput("cache-dependency-glob");
/***/ }), /***/ }),
@ -82988,31 +82987,30 @@ exports.cacheDependencyGlob = core.getInput('cache-dependency-glob');
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getPlatform = exports.getArch = void 0; exports.getArch = getArch;
exports.getPlatform = getPlatform;
function getArch() { function getArch() {
const arch = process.arch; const arch = process.arch;
const archMapping = { const archMapping = {
ia32: 'i686', ia32: "i686",
x64: 'x86_64', x64: "x86_64",
arm64: 'aarch64' arm64: "aarch64",
}; };
if (arch in archMapping) { if (arch in archMapping) {
return archMapping[arch]; return archMapping[arch];
} }
} }
exports.getArch = getArch;
function getPlatform() { function getPlatform() {
const platform = process.platform; const platform = process.platform;
const platformMapping = { const platformMapping = {
linux: 'unknown-linux-gnu', linux: "unknown-linux-gnu",
darwin: 'apple-darwin', darwin: "apple-darwin",
win32: 'pc-windows-msvc' win32: "pc-windows-msvc",
}; };
if (platform in platformMapping) { if (platform in platformMapping) {
return platformMapping[platform]; return platformMapping[platform];
} }
} }
exports.getPlatform = getPlatform;
/***/ }), /***/ }),

3306
dist/setup/index.js generated vendored

File diff suppressed because it is too large Load diff

38
dist/update-default-version/index.js generated vendored
View file

@ -32713,34 +32713,34 @@ const tc = __importStar(__nccwpck_require__(7784));
function updateChecksums(filePath, downloadUrls) { function updateChecksums(filePath, downloadUrls) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
yield fs_1.promises.rm(filePath); yield fs_1.promises.rm(filePath);
yield fs_1.promises.appendFile(filePath, '// AUTOGENERATED_DO_NOT_EDIT\nexport const KNOWN_CHECKSUMS: {[key: string]: string} = {\n'); yield fs_1.promises.appendFile(filePath, "// AUTOGENERATED_DO_NOT_EDIT\nexport const KNOWN_CHECKSUMS: {[key: string]: string} = {\n");
let firstLine = true; let firstLine = true;
for (const downloadUrl of downloadUrls) { for (const downloadUrl of downloadUrls) {
const content = yield downloadAssetContent(downloadUrl); const content = yield downloadAssetContent(downloadUrl);
const checksum = content.split(' ')[0].trim(); const checksum = content.split(" ")[0].trim();
const key = getKey(downloadUrl); const key = getKey(downloadUrl);
if (!firstLine) { if (!firstLine) {
yield fs_1.promises.appendFile(filePath, ',\n'); yield fs_1.promises.appendFile(filePath, ",\n");
} }
yield fs_1.promises.appendFile(filePath, ` '${key}':\n '${checksum}'`); yield fs_1.promises.appendFile(filePath, ` '${key}':\n '${checksum}'`);
firstLine = false; firstLine = false;
} }
yield fs_1.promises.appendFile(filePath, '}\n'); yield fs_1.promises.appendFile(filePath, "}\n");
}); });
} }
exports.updateChecksums = updateChecksums; exports.updateChecksums = updateChecksums;
function getKey(downloadUrl) { function getKey(downloadUrl) {
// https://github.com/astral-sh/uv/releases/download/0.3.2/uv-aarch64-apple-darwin.tar.gz.sha256 // https://github.com/astral-sh/uv/releases/download/0.3.2/uv-aarch64-apple-darwin.tar.gz.sha256
const parts = downloadUrl.split('/'); const parts = downloadUrl.split("/");
const fileName = parts[parts.length - 1]; const fileName = parts[parts.length - 1];
const name = fileName.split('.')[0].split('uv-')[1]; const name = fileName.split(".")[0].split("uv-")[1];
const version = parts[parts.length - 2]; const version = parts[parts.length - 2];
return `${name}-${version}`; return `${name}-${version}`;
} }
function downloadAssetContent(downloadUrl) { function downloadAssetContent(downloadUrl) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const downloadPath = yield tc.downloadTool(downloadUrl); const downloadPath = yield tc.downloadTool(downloadUrl);
const content = yield fs_1.promises.readFile(downloadPath, 'utf8'); const content = yield fs_1.promises.readFile(downloadPath, "utf8");
return content; return content;
}); });
} }
@ -32808,16 +32808,16 @@ function run() {
const octokit = github.getOctokit(github_token); const octokit = github.getOctokit(github_token);
const response = yield octokit.paginate(octokit.rest.repos.listReleases, { const response = yield octokit.paginate(octokit.rest.repos.listReleases, {
owner: utils_1.OWNER, owner: utils_1.OWNER,
repo: utils_1.REPO repo: utils_1.REPO,
}); });
const downloadUrls = response.flatMap(release => release.assets const downloadUrls = response.flatMap((release) => release.assets
.filter(asset => asset.name.endsWith('.sha256')) .filter((asset) => asset.name.endsWith(".sha256"))
.map(asset => asset.browser_download_url)); .map((asset) => asset.browser_download_url));
yield (0, update_known_checksums_1.updateChecksums)(checksumFilePath, downloadUrls); yield (0, update_known_checksums_1.updateChecksums)(checksumFilePath, downloadUrls);
const latestVersion = response const latestVersion = response
.map(release => release.tag_name) .map((release) => release.tag_name)
.sort(semver.rcompare)[0]; .sort(semver.rcompare)[0];
core.setOutput('latest-version', latestVersion); core.setOutput("latest-version", latestVersion);
yield updateDefaultVersion(defaultVersionFilePath, latestVersion); yield updateDefaultVersion(defaultVersionFilePath, latestVersion);
}); });
} }
@ -32826,7 +32826,7 @@ function updateDefaultVersion(filePath, latestVersion) {
var _a, e_1, _b, _c; var _a, e_1, _b, _c;
const fileStream = (0, fs_1.createReadStream)(filePath); const fileStream = (0, fs_1.createReadStream)(filePath);
const rl = readline.createInterface({ const rl = readline.createInterface({
input: fileStream input: fileStream,
}); });
let foundDescription = false; let foundDescription = false;
const lines = []; const lines = [];
@ -32839,7 +32839,7 @@ function updateDefaultVersion(filePath, latestVersion) {
line.includes("description: 'The version of uv to install'")) { line.includes("description: 'The version of uv to install'")) {
foundDescription = true; foundDescription = true;
} }
else if (foundDescription && line.includes('default: ')) { else if (foundDescription && line.includes("default: ")) {
line = line.replace(/'[^']*'/, `'${latestVersion}'`); line = line.replace(/'[^']*'/, `'${latestVersion}'`);
foundDescription = false; foundDescription = false;
} }
@ -32853,7 +32853,7 @@ function updateDefaultVersion(filePath, latestVersion) {
} }
finally { if (e_1) throw e_1.error; } finally { if (e_1) throw e_1.error; }
} }
yield fs_1.promises.writeFile(filePath, lines.join('\n')); yield fs_1.promises.writeFile(filePath, lines.join("\n"));
}); });
} }
run(); run();
@ -32868,9 +32868,9 @@ run();
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0; exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
exports.REPO = 'uv'; exports.REPO = "uv";
exports.OWNER = 'astral-sh'; exports.OWNER = "astral-sh";
exports.TOOL_CACHE_NAME = 'uv'; exports.TOOL_CACHE_NAME = "uv";
/***/ }), /***/ }),

34736
dist/update-known-checksums/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 36 KiB

View file

@ -1,15 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="545" height="153" viewBox="0 0 545 153">
<defs>
<style>
.cls-1{fill:#009ee3;}.cls-1,.cls-2,.cls-3{fill-rule:evenodd;}.cls-2{fill:#113984;}.cls-3{fill:#172c70;}</style>
</defs>
<title>paypal-seeklogo.com</title>
<path transform="scale(1, 1)" d="M0 24.48C0 10.9601 10.9601 0 24.48 0H520.2C533.72 0 544.68 10.9601 544.68 24.48V128.52C544.68 142.04 533.72 153 520.2 153H24.48C10.9601 153 0 142.04 0 128.52V24.48Z" fill="#ebf2ff"/>
<g transform="scale(0.8, 0.8) translate(45, 25)">
<path class="cls-1" d="M192.95,386.87h38.74c20.8,0,28.63,10.53,27.42,26-2,25.54-17.44,39.67-37.92,39.67H210.85c-2.81,0-4.7,1.86-5.46,6.9L201,488.74c-0.29,1.9-1.29,3-2.79,3.15H173.87c-2.29,0-3.1-1.75-2.5-5.54l14.84-93.93C186.79,388.66,188.85,386.87,192.95,386.87Z" transform="translate(-143.48 -354.54)"/>
<path class="cls-2" d="M361.14,385.13c13.07,0,25.13,7.09,23.48,24.76-2,21-13.25,32.62-31,32.67H338.11c-2.23,0-3.31,1.82-3.89,5.55l-3,19.07c-0.45,2.88-1.93,4.3-4.11,4.3H312.68c-2.3,0-3.1-1.47-2.59-4.76L322,390.29c0.59-3.76,2-5.16,4.57-5.16h34.54Zm-23.5,40.92h11.75c7.35-.28,12.23-5.37,12.72-14.55,0.3-5.67-3.53-9.73-9.62-9.7l-11.06.05-3.79,24.2h0Zm86.21,39.58c1.32-1.2,2.66-1.82,2.47-.34l-0.47,3.54c-0.24,1.85.49,2.83,2.21,2.83h12.82c2.16,0,3.21-.87,3.74-4.21l7.9-49.58c0.4-2.49-.21-3.71-2.1-3.71H436.32c-1.27,0-1.89.71-2.22,2.65l-0.52,3.05c-0.27,1.59-1,1.87-1.68.27-2.39-5.66-8.49-8.2-17-8-19.77.41-33.1,15.42-34.53,34.66-1.1,14.88,9.56,26.57,23.62,26.57,10.2,0,14.76-3,19.9-7.7h0ZM413.11,458c-8.51,0-14.44-6.79-13.21-15.11s9.19-15.11,17.7-15.11,14.44,6.79,13.21,15.11S421.63,458,413.11,458h0Zm64.5-44h-13c-2.68,0-3.77,2-2.92,4.46l16.14,47.26L462,488.21c-1.33,1.88-.3,3.59,1.57,3.59h14.61a4.47,4.47,0,0,0,4.34-2.13l49.64-71.2c1.53-2.19.81-4.49-1.7-4.49H516.63c-2.37,0-3.32.94-4.68,2.91l-20.7,30L482,416.82C481.46,415,480.11,414,477.62,414Z" transform="translate(-143.48 -354.54)"/>
<path class="cls-1" d="M583.8,385.13c13.07,0,25.13,7.09,23.48,24.76-2,21-13.25,32.62-31,32.67H560.78c-2.23,0-3.31,1.82-3.89,5.55l-3,19.07c-0.45,2.88-1.93,4.3-4.11,4.3H535.35c-2.3,0-3.1-1.47-2.59-4.76l11.93-76.45c0.59-3.76,2-5.16,4.57-5.16H583.8Zm-23.5,40.92h11.75c7.35-.28,12.23-5.37,12.72-14.55,0.3-5.67-3.53-9.73-9.62-9.7l-11.06.05-3.79,24.2h0Zm86.21,39.58c1.32-1.2,2.66-1.82,2.47-.34l-0.47,3.54c-0.24,1.85.49,2.83,2.21,2.83h12.82c2.16,0,3.21-.87,3.74-4.21l7.9-49.58c0.4-2.49-.21-3.71-2.1-3.71H659c-1.27,0-1.89.71-2.22,2.65l-0.52,3.05c-0.27,1.59-1,1.87-1.68.27-2.39-5.66-8.49-8.2-17-8-19.77.41-33.1,15.42-34.53,34.66-1.1,14.88,9.56,26.57,23.62,26.57,10.2,0,14.76-3,19.9-7.7h0ZM635.78,458c-8.51,0-14.44-6.79-13.21-15.11s9.19-15.11,17.7-15.11,14.44,6.79,13.21,15.11S644.29,458,635.78,458h0Zm59.13,13.74h-14.8a1.75,1.75,0,0,1-1.81-2l13-82.36a2.55,2.55,0,0,1,2.46-2h14.8a1.75,1.75,0,0,1,1.81,2l-13,82.36A2.55,2.55,0,0,1,694.91,471.76Z" transform="translate(-143.48 -354.54)"/>
<path class="cls-2" d="M168.72,354.54h38.78c10.92,0,23.88.35,32.54,8,5.79,5.11,8.83,13.24,8.13,22-2.38,29.61-20.09,46.2-43.85,46.2H185.2c-3.26,0-5.41,2.16-6.33,8l-5.34,34c-0.35,2.2-1.3,3.5-3,3.66H146.6c-2.65,0-3.59-2-2.9-6.42L160.9,361C161.59,356.62,164,354.54,168.72,354.54Z" transform="translate(-143.48 -354.54)"/>
<path class="cls-3" d="M179.43,435.29l6.77-42.87c0.59-3.76,2.65-5.56,6.75-5.56h38.74c6.41,0,11.6,1,15.66,2.85-3.89,26.36-20.94,41-43.26,41H185C182.44,430.72,180.56,432,179.43,435.29Z" transform="translate(-143.48 -354.54)"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -1,9 +1,9 @@
module.exports = { module.exports = {
clearMocks: true, clearMocks: true,
moduleFileExtensions: ['js', 'ts'], moduleFileExtensions: ["js", "ts"],
testMatch: ['**/*.test.ts'], testMatch: ["**/*.test.ts"],
transform: { transform: {
'^.+\\.ts$': 'ts-jest' "^.+\\.ts$": "ts-jest",
}, },
verbose: true verbose: true,
} };

364
package-lock.json generated
View file

@ -19,21 +19,21 @@
"@octokit/rest": "^21.0.2" "@octokit/rest": "^21.0.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.14.9", "@types/node": "^22.5.4",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^7.15.0", "@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0", "@typescript-eslint/parser": "^7.18.0",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-github": "^5.0.1", "eslint-plugin-github": "^5.0.1",
"eslint-plugin-import": "^2.29.1", "eslint-plugin-import": "^2.30.0",
"eslint-plugin-jest": "^28.6.0", "eslint-plugin-jest": "^28.8.3",
"eslint-plugin-prettier": "^5.2.1", "eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0", "jest": "^29.7.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"ts-jest": "^29.2.5", "ts-jest": "^29.2.5",
"typescript": "^5.4.5" "typescript": "^5.5.4"
} }
}, },
"node_modules/@aashutoshrathi/word-wrap": { "node_modules/@aashutoshrathi/word-wrap": {
@ -1988,6 +1988,12 @@
"url": "https://opencollective.com/unts" "url": "https://opencollective.com/unts"
} }
}, },
"node_modules/@rtsao/scc": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",
"integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==",
"dev": true
},
"node_modules/@sinclair/typebox": { "node_modules/@sinclair/typebox": {
"version": "0.27.8", "version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
@ -2093,11 +2099,11 @@
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "20.14.9", "version": "22.5.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz",
"integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==",
"dependencies": { "dependencies": {
"undici-types": "~5.26.4" "undici-types": "~6.19.2"
} }
}, },
"node_modules/@types/node-fetch": { "node_modules/@types/node-fetch": {
@ -2191,15 +2197,15 @@
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "7.15.0", "version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.15.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.18.0.tgz",
"integrity": "sha512-k9fYuQNnypLFcqORNClRykkGOMOj+pV6V91R4GO/l1FDGwpqmSwoOQrOHo3cGaH63e+D3ZiCAOsuS/D2c99j/A==", "integrity": "sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "7.15.0", "@typescript-eslint/scope-manager": "7.18.0",
"@typescript-eslint/types": "7.15.0", "@typescript-eslint/types": "7.18.0",
"@typescript-eslint/typescript-estree": "7.15.0", "@typescript-eslint/typescript-estree": "7.18.0",
"@typescript-eslint/visitor-keys": "7.15.0", "@typescript-eslint/visitor-keys": "7.18.0",
"debug": "^4.3.4" "debug": "^4.3.4"
}, },
"engines": { "engines": {
@ -2218,6 +2224,117 @@
} }
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz",
"integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz",
"integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==",
"dev": true,
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz",
"integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"minimatch": "^9.0.4",
"semver": "^7.6.0",
"ts-api-utils": "^1.3.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz",
"integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "7.18.0",
"eslint-visitor-keys": "^3.4.3"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/@typescript-eslint/parser/node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/@typescript-eslint/parser/node_modules/semver": {
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
"dev": true,
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/scope-manager": {
"version": "7.15.0", "version": "7.15.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.15.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.15.0.tgz",
@ -3591,9 +3708,9 @@
} }
}, },
"node_modules/eslint-module-utils": { "node_modules/eslint-module-utils": {
"version": "2.8.1", "version": "2.9.0",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.9.0.tgz",
"integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==", "integrity": "sha512-McVbYmwA3NEKwRQY5g4aWMdcZE5xZxV8i8l7CqJSrameuGSQJtSWaL/LxTEzSKKaCcOhlpDR8XEfYXWPrdo/ZQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"debug": "^3.2.7" "debug": "^3.2.7"
@ -3761,26 +3878,27 @@
} }
}, },
"node_modules/eslint-plugin-import": { "node_modules/eslint-plugin-import": {
"version": "2.29.1", "version": "2.30.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.30.0.tgz",
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", "integrity": "sha512-/mHNE9jINJfiD2EKkg1BKyPyUk4zdnT54YgbOgfjSakWT5oyX/qQLVNTkehyfpcMxZXMy1zyonZ2v7hZTX43Yw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"array-includes": "^3.1.7", "@rtsao/scc": "^1.1.0",
"array.prototype.findlastindex": "^1.2.3", "array-includes": "^3.1.8",
"array.prototype.findlastindex": "^1.2.5",
"array.prototype.flat": "^1.3.2", "array.prototype.flat": "^1.3.2",
"array.prototype.flatmap": "^1.3.2", "array.prototype.flatmap": "^1.3.2",
"debug": "^3.2.7", "debug": "^3.2.7",
"doctrine": "^2.1.0", "doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.9", "eslint-import-resolver-node": "^0.3.9",
"eslint-module-utils": "^2.8.0", "eslint-module-utils": "^2.9.0",
"hasown": "^2.0.0", "hasown": "^2.0.2",
"is-core-module": "^2.13.1", "is-core-module": "^2.15.1",
"is-glob": "^4.0.3", "is-glob": "^4.0.3",
"minimatch": "^3.1.2", "minimatch": "^3.1.2",
"object.fromentries": "^2.0.7", "object.fromentries": "^2.0.8",
"object.groupby": "^1.0.1", "object.groupby": "^1.0.3",
"object.values": "^1.1.7", "object.values": "^1.2.0",
"semver": "^6.3.1", "semver": "^6.3.1",
"tsconfig-paths": "^3.15.0" "tsconfig-paths": "^3.15.0"
}, },
@ -3801,18 +3919,18 @@
} }
}, },
"node_modules/eslint-plugin-jest": { "node_modules/eslint-plugin-jest": {
"version": "28.6.0", "version": "28.8.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.6.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.8.3.tgz",
"integrity": "sha512-YG28E1/MIKwnz+e2H7VwYPzHUYU4aMa19w0yGcwXnnmJH6EfgHahTJ2un3IyraUxNfnz/KUhJAFXNNwWPo12tg==", "integrity": "sha512-HIQ3t9hASLKm2IhIOqnu+ifw7uLZkIlR7RYNv7fMcEi/p0CIiJmfriStQS2LDkgtY4nyLbIZAD+JL347Yc2ETQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/utils": "^6.0.0 || ^7.0.0" "@typescript-eslint/utils": "^6.0.0 || ^7.0.0 || ^8.0.0"
}, },
"engines": { "engines": {
"node": "^16.10.0 || ^18.12.0 || >=20.0.0" "node": "^16.10.0 || ^18.12.0 || >=20.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript-eslint/eslint-plugin": "^6.0.0 || ^7.0.0", "@typescript-eslint/eslint-plugin": "^6.0.0 || ^7.0.0 || ^8.0.0",
"eslint": "^7.0.0 || ^8.0.0 || ^9.0.0", "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0",
"jest": "*" "jest": "*"
}, },
@ -4883,12 +5001,15 @@
} }
}, },
"node_modules/is-core-module": { "node_modules/is-core-module": {
"version": "2.13.1", "version": "2.15.1",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz",
"integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"hasown": "^2.0.0" "hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
@ -7437,9 +7558,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.4.5", "version": "5.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"dev": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@ -7476,9 +7597,9 @@
} }
}, },
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "5.26.5", "version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="
}, },
"node_modules/universal-user-agent": { "node_modules/universal-user-agent": {
"version": "6.0.1", "version": "6.0.1",
@ -9335,6 +9456,12 @@
"integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==",
"dev": true "dev": true
}, },
"@rtsao/scc": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",
"integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==",
"dev": true
},
"@sinclair/typebox": { "@sinclair/typebox": {
"version": "0.27.8", "version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
@ -9440,11 +9567,11 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "20.14.9", "version": "22.5.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz",
"integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==",
"requires": { "requires": {
"undici-types": "~5.26.4" "undici-types": "~6.19.2"
} }
}, },
"@types/node-fetch": { "@types/node-fetch": {
@ -9521,16 +9648,84 @@
} }
}, },
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "7.15.0", "version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.15.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.18.0.tgz",
"integrity": "sha512-k9fYuQNnypLFcqORNClRykkGOMOj+pV6V91R4GO/l1FDGwpqmSwoOQrOHo3cGaH63e+D3ZiCAOsuS/D2c99j/A==", "integrity": "sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/scope-manager": "7.15.0", "@typescript-eslint/scope-manager": "7.18.0",
"@typescript-eslint/types": "7.15.0", "@typescript-eslint/types": "7.18.0",
"@typescript-eslint/typescript-estree": "7.15.0", "@typescript-eslint/typescript-estree": "7.18.0",
"@typescript-eslint/visitor-keys": "7.15.0", "@typescript-eslint/visitor-keys": "7.18.0",
"debug": "^4.3.4" "debug": "^4.3.4"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz",
"integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0"
}
},
"@typescript-eslint/types": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz",
"integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz",
"integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"minimatch": "^9.0.4",
"semver": "^7.6.0",
"ts-api-utils": "^1.3.0"
}
},
"@typescript-eslint/visitor-keys": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz",
"integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==",
"dev": true,
"requires": {
"@typescript-eslint/types": "7.18.0",
"eslint-visitor-keys": "^3.4.3"
}
},
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0"
}
},
"minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"requires": {
"brace-expansion": "^2.0.1"
}
},
"semver": {
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
"dev": true
}
} }
}, },
"@typescript-eslint/scope-manager": { "@typescript-eslint/scope-manager": {
@ -10596,9 +10791,9 @@
} }
}, },
"eslint-module-utils": { "eslint-module-utils": {
"version": "2.8.1", "version": "2.9.0",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.9.0.tgz",
"integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==", "integrity": "sha512-McVbYmwA3NEKwRQY5g4aWMdcZE5xZxV8i8l7CqJSrameuGSQJtSWaL/LxTEzSKKaCcOhlpDR8XEfYXWPrdo/ZQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "^3.2.7" "debug": "^3.2.7"
@ -10732,26 +10927,27 @@
"requires": {} "requires": {}
}, },
"eslint-plugin-import": { "eslint-plugin-import": {
"version": "2.29.1", "version": "2.30.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.30.0.tgz",
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", "integrity": "sha512-/mHNE9jINJfiD2EKkg1BKyPyUk4zdnT54YgbOgfjSakWT5oyX/qQLVNTkehyfpcMxZXMy1zyonZ2v7hZTX43Yw==",
"dev": true, "dev": true,
"requires": { "requires": {
"array-includes": "^3.1.7", "@rtsao/scc": "^1.1.0",
"array.prototype.findlastindex": "^1.2.3", "array-includes": "^3.1.8",
"array.prototype.findlastindex": "^1.2.5",
"array.prototype.flat": "^1.3.2", "array.prototype.flat": "^1.3.2",
"array.prototype.flatmap": "^1.3.2", "array.prototype.flatmap": "^1.3.2",
"debug": "^3.2.7", "debug": "^3.2.7",
"doctrine": "^2.1.0", "doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.9", "eslint-import-resolver-node": "^0.3.9",
"eslint-module-utils": "^2.8.0", "eslint-module-utils": "^2.9.0",
"hasown": "^2.0.0", "hasown": "^2.0.2",
"is-core-module": "^2.13.1", "is-core-module": "^2.15.1",
"is-glob": "^4.0.3", "is-glob": "^4.0.3",
"minimatch": "^3.1.2", "minimatch": "^3.1.2",
"object.fromentries": "^2.0.7", "object.fromentries": "^2.0.8",
"object.groupby": "^1.0.1", "object.groupby": "^1.0.3",
"object.values": "^1.1.7", "object.values": "^1.2.0",
"semver": "^6.3.1", "semver": "^6.3.1",
"tsconfig-paths": "^3.15.0" "tsconfig-paths": "^3.15.0"
}, },
@ -10768,12 +10964,12 @@
} }
}, },
"eslint-plugin-jest": { "eslint-plugin-jest": {
"version": "28.6.0", "version": "28.8.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.6.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.8.3.tgz",
"integrity": "sha512-YG28E1/MIKwnz+e2H7VwYPzHUYU4aMa19w0yGcwXnnmJH6EfgHahTJ2un3IyraUxNfnz/KUhJAFXNNwWPo12tg==", "integrity": "sha512-HIQ3t9hASLKm2IhIOqnu+ifw7uLZkIlR7RYNv7fMcEi/p0CIiJmfriStQS2LDkgtY4nyLbIZAD+JL347Yc2ETQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/utils": "^6.0.0 || ^7.0.0" "@typescript-eslint/utils": "^6.0.0 || ^7.0.0 || ^8.0.0"
} }
}, },
"eslint-plugin-no-only-tests": { "eslint-plugin-no-only-tests": {
@ -11437,12 +11633,12 @@
"dev": true "dev": true
}, },
"is-core-module": { "is-core-module": {
"version": "2.13.1", "version": "2.15.1",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz",
"integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"hasown": "^2.0.0" "hasown": "^2.0.2"
} }
}, },
"is-data-view": { "is-data-view": {
@ -13276,9 +13472,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "5.4.5", "version": "5.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"dev": true "dev": true
}, },
"unbox-primitive": { "unbox-primitive": {
@ -13302,9 +13498,9 @@
} }
}, },
"undici-types": { "undici-types": {
"version": "5.26.5", "version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="
}, },
"universal-user-agent": { "universal-user-agent": {
"version": "6.0.1", "version": "6.0.1",

View file

@ -6,18 +6,18 @@
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"format": "prettier --write '**/*.ts'", "format": "prettier --write .",
"format-check": "prettier --check '**/*.ts'", "format-check": "prettier --check .",
"lint": "eslint src/**/*.ts --fix", "lint": "eslint src/**/*.ts --fix",
"package": "ncc build -o dist/setup src/setup-uv.ts && ncc build -o dist/save-cache src/save-cache.ts && ncc build -o dist/update-default-version src/update-default-version.ts", "package": "ncc build -o dist/setup src/setup-uv.ts && ncc build -o dist/save-cache src/save-cache.ts && ncc build -o dist/update-known-checksums src/update-known-checksums.ts",
"test": "jest", "test": "jest",
"act": "act pull_request -W .github/workflows/test.yml --container-architecture linux/amd64 -s GITHUB_TOKEN=\"$(gh auth token)\"", "act": "act pull_request -W .github/workflows/test.yml --container-architecture linux/amd64 -s GITHUB_TOKEN=\"$(gh auth token)\"",
"update-default-version": "node dist/update-default-version/index.js src/download/checksum/known-checksums.ts action.yml \"$(gh auth token)\"", "update-known-checksums": "node dist/update-known-checksums/index.js src/download/checksum/known-checksums.ts \"$(gh auth token)\"",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test" "all": "npm run build && npm run format && npm run lint && npm run package && npm test"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/eifinger/setup-uv.git" "url": "git+https://github.com/astral-sh/setup-uv.git"
}, },
"keywords": [ "keywords": [
"actions", "actions",
@ -38,20 +38,20 @@
"@octokit/rest": "^21.0.2" "@octokit/rest": "^21.0.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.14.9", "@types/node": "^22.5.4",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^7.15.0", "@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0", "@typescript-eslint/parser": "^7.18.0",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-github": "^5.0.1", "eslint-plugin-github": "^5.0.1",
"eslint-plugin-import": "^2.29.1", "eslint-plugin-import": "^2.30.0",
"eslint-plugin-jest": "^28.6.0", "eslint-plugin-jest": "^28.8.3",
"eslint-plugin-prettier": "^5.2.1", "eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0", "jest": "^29.7.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"ts-jest": "^29.2.5", "ts-jest": "^29.2.5",
"typescript": "^5.4.5" "typescript": "^5.5.4"
} }
} }

View file

@ -1,65 +1,69 @@
import * as cache from '@actions/cache' import * as cache from "@actions/cache";
import * as glob from '@actions/glob' import * as glob from "@actions/glob";
import * as core from '@actions/core' import * as core from "@actions/core";
import path from 'path' import path from "path";
import {cacheDependencyGlob, cacheLocalPath, cacheSuffix} from '../utils/inputs' import {
import {getArch, getPlatform} from '../utils/platforms' cacheDependencyGlob,
cacheLocalPath,
cacheSuffix,
} from "../utils/inputs";
import { getArch, getPlatform } from "../utils/platforms";
export const STATE_CACHE_KEY = 'cache-key' export const STATE_CACHE_KEY = "cache-key";
export const STATE_CACHE_MATCHED_KEY = 'cache-matched-key' export const STATE_CACHE_MATCHED_KEY = "cache-matched-key";
const CACHE_VERSION = '1' const CACHE_VERSION = "1";
export async function restoreCache(version: string): Promise<void> { export async function restoreCache(version: string): Promise<void> {
const cacheKey = await computeKeys(version) const cacheKey = await computeKeys(version);
let matchedKey: string | undefined let matchedKey: string | undefined;
core.info( core.info(
`Trying to restore uv cache from GitHub Actions cache with key: ${cacheKey}` `Trying to restore uv cache from GitHub Actions cache with key: ${cacheKey}`,
) );
try { try {
matchedKey = await cache.restoreCache([cacheLocalPath], cacheKey) matchedKey = await cache.restoreCache([cacheLocalPath], cacheKey);
} catch (err) { } catch (err) {
const message = (err as Error).message const message = (err as Error).message;
core.warning(message) core.warning(message);
core.setOutput('cache-hit', false) core.setOutput("cache-hit", false);
return return;
} }
core.saveState(STATE_CACHE_KEY, cacheKey) core.saveState(STATE_CACHE_KEY, cacheKey);
handleMatchResult(matchedKey, cacheKey) handleMatchResult(matchedKey, cacheKey);
} }
async function computeKeys(version: string): Promise<string> { async function computeKeys(version: string): Promise<string> {
let cacheDependencyPathHash = '-' let cacheDependencyPathHash = "-";
if (cacheDependencyGlob !== '') { if (cacheDependencyGlob !== "") {
const fullCacheDependencyGlob = `${process.env['GITHUB_WORKSPACE']}${path.sep}${cacheDependencyGlob}` const fullCacheDependencyGlob = `${process.env["GITHUB_WORKSPACE"]}${path.sep}${cacheDependencyGlob}`;
cacheDependencyPathHash += await glob.hashFiles(fullCacheDependencyGlob) cacheDependencyPathHash += await glob.hashFiles(fullCacheDependencyGlob);
if (cacheDependencyPathHash === '-') { if (cacheDependencyPathHash === "-") {
throw new Error( throw new Error(
`No file in ${process.cwd()} matched to [${cacheDependencyGlob}], make sure you have checked out the target repository` `No file in ${process.cwd()} matched to [${cacheDependencyGlob}], make sure you have checked out the target repository`,
) );
} }
} else { } else {
cacheDependencyPathHash += 'no-dependency-glob' cacheDependencyPathHash += "no-dependency-glob";
} }
const suffix = cacheSuffix ? `-${cacheSuffix}` : '' const suffix = cacheSuffix ? `-${cacheSuffix}` : "";
return `setup-uv-${CACHE_VERSION}-${getArch()}-${getPlatform()}-${version}${cacheDependencyPathHash}${suffix}` return `setup-uv-${CACHE_VERSION}-${getArch()}-${getPlatform()}-${version}${cacheDependencyPathHash}${suffix}`;
} }
function handleMatchResult( function handleMatchResult(
matchedKey: string | undefined, matchedKey: string | undefined,
primaryKey: string primaryKey: string,
): void { ): void {
if (!matchedKey) { if (!matchedKey) {
core.info(`No GitHub Actions cache found for key: ${primaryKey}`) core.info(`No GitHub Actions cache found for key: ${primaryKey}`);
core.setOutput('cache-hit', false) core.setOutput("cache-hit", false);
return return;
} }
core.saveState(STATE_CACHE_MATCHED_KEY, matchedKey) core.saveState(STATE_CACHE_MATCHED_KEY, matchedKey);
core.info( core.info(
`uv cache restored from GitHub Actions cache with key: ${matchedKey}` `uv cache restored from GitHub Actions cache with key: ${matchedKey}`,
) );
core.setOutput('cache-hit', true) core.setOutput("cache-hit", true);
} }

View file

@ -1,55 +1,55 @@
import * as fs from 'fs' import * as fs from "fs";
import * as crypto from 'crypto' import * as crypto from "crypto";
import * as core from '@actions/core' import * as core from "@actions/core";
import {KNOWN_CHECKSUMS} from './known-checksums' import { KNOWN_CHECKSUMS } from "./known-checksums";
import {Architecture, Platform} from '../../utils/platforms' import { Architecture, Platform } from "../../utils/platforms";
export async function validateChecksum( export async function validateChecksum(
checkSum: string | undefined, checkSum: string | undefined,
downloadPath: string, downloadPath: string,
arch: Architecture, arch: Architecture,
platform: Platform, platform: Platform,
version: string version: string,
): Promise<void> { ): Promise<void> {
let isValid = true let isValid = true;
if (checkSum !== undefined && checkSum !== '') { if (checkSum !== undefined && checkSum !== "") {
isValid = await validateFileCheckSum(downloadPath, checkSum) isValid = await validateFileCheckSum(downloadPath, checkSum);
} else { } else {
core.debug(`Checksum not provided. Checking known checksums.`) core.debug(`Checksum not provided. Checking known checksums.`);
const key = `${arch}-${platform}-${version}` const key = `${arch}-${platform}-${version}`;
if (key in KNOWN_CHECKSUMS) { if (key in KNOWN_CHECKSUMS) {
const knownChecksum = KNOWN_CHECKSUMS[`${arch}-${platform}-${version}`] const knownChecksum = KNOWN_CHECKSUMS[`${arch}-${platform}-${version}`];
core.debug(`Checking checksum for ${arch}-${platform}-${version}.`) core.debug(`Checking checksum for ${arch}-${platform}-${version}.`);
isValid = await validateFileCheckSum(downloadPath, knownChecksum) isValid = await validateFileCheckSum(downloadPath, knownChecksum);
} else { } else {
core.debug(`No known checksum found for ${key}.`) core.debug(`No known checksum found for ${key}.`);
} }
} }
if (!isValid) { if (!isValid) {
throw new Error(`Checksum for ${downloadPath} did not match ${checkSum}.`) throw new Error(`Checksum for ${downloadPath} did not match ${checkSum}.`);
} }
core.debug(`Checksum for ${downloadPath} is valid.`) core.debug(`Checksum for ${downloadPath} is valid.`);
} }
async function validateFileCheckSum( async function validateFileCheckSum(
filePath: string, filePath: string,
expected: string expected: string,
): Promise<boolean> { ): Promise<boolean> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const hash = crypto.createHash('sha256') const hash = crypto.createHash("sha256");
const stream = fs.createReadStream(filePath) const stream = fs.createReadStream(filePath);
stream.on('error', err => reject(err)) stream.on("error", (err) => reject(err));
stream.on('data', chunk => hash.update(chunk)) stream.on("data", (chunk) => hash.update(chunk));
stream.on('end', () => { stream.on("end", () => {
const actual = hash.digest('hex') const actual = hash.digest("hex");
resolve(actual === expected) resolve(actual === expected);
}) });
}) });
} }
export function isknownVersion(version: string): boolean { export function isknownVersion(version: string): boolean {
const pattern = new RegExp(`^.*-.*-${version}$`) const pattern = new RegExp(`^.*-.*-${version}$`);
return Object.keys(KNOWN_CHECKSUMS).some(key => pattern.test(key)) return Object.keys(KNOWN_CHECKSUMS).some((key) => pattern.test(key));
} }

File diff suppressed because it is too large Load diff

View file

@ -1,39 +1,39 @@
import {promises as fs} from 'fs' import { promises as fs } from "fs";
import * as tc from '@actions/tool-cache' import * as tc from "@actions/tool-cache";
export async function updateChecksums( export async function updateChecksums(
filePath: string, filePath: string,
downloadUrls: string[] downloadUrls: string[],
): Promise<void> { ): Promise<void> {
await fs.rm(filePath) await fs.rm(filePath);
await fs.appendFile( await fs.appendFile(
filePath, filePath,
'// AUTOGENERATED_DO_NOT_EDIT\nexport const KNOWN_CHECKSUMS: {[key: string]: string} = {\n' "// AUTOGENERATED_DO_NOT_EDIT\nexport const KNOWN_CHECKSUMS: {[key: string]: string} = {\n",
) );
let firstLine = true let firstLine = true;
for (const downloadUrl of downloadUrls) { for (const downloadUrl of downloadUrls) {
const content = await downloadAssetContent(downloadUrl) const content = await downloadAssetContent(downloadUrl);
const checksum = content.split(' ')[0].trim() const checksum = content.split(" ")[0].trim();
const key = getKey(downloadUrl) const key = getKey(downloadUrl);
if (!firstLine) { if (!firstLine) {
await fs.appendFile(filePath, ',\n') await fs.appendFile(filePath, ",\n");
} }
await fs.appendFile(filePath, ` '${key}':\n '${checksum}'`) await fs.appendFile(filePath, ` '${key}':\n '${checksum}'`);
firstLine = false firstLine = false;
} }
await fs.appendFile(filePath, '}\n') await fs.appendFile(filePath, "}\n");
} }
function getKey(downloadUrl: string): string { function getKey(downloadUrl: string): string {
// https://github.com/astral-sh/uv/releases/download/0.3.2/uv-aarch64-apple-darwin.tar.gz.sha256 // https://github.com/astral-sh/uv/releases/download/0.3.2/uv-aarch64-apple-darwin.tar.gz.sha256
const parts = downloadUrl.split('/') const parts = downloadUrl.split("/");
const fileName = parts[parts.length - 1] const fileName = parts[parts.length - 1];
const name = fileName.split('.')[0].split('uv-')[1] const name = fileName.split(".")[0].split("uv-")[1];
const version = parts[parts.length - 2] const version = parts[parts.length - 2];
return `${name}-${version}` return `${name}-${version}`;
} }
async function downloadAssetContent(downloadUrl: string): Promise<string> { async function downloadAssetContent(downloadUrl: string): Promise<string> {
const downloadPath = await tc.downloadTool(downloadUrl) const downloadPath = await tc.downloadTool(downloadUrl);
const content = await fs.readFile(downloadPath, 'utf8') const content = await fs.readFile(downloadPath, "utf8");
return content return content;
} }

View file

@ -1,47 +1,52 @@
import * as core from '@actions/core' import * as core from "@actions/core";
import * as tc from '@actions/tool-cache' import * as tc from "@actions/tool-cache";
import * as exec from '@actions/exec' import * as exec from "@actions/exec";
import * as path from 'path' import * as path from "path";
import {Architecture, Platform} from '../utils/platforms' import { Architecture, Platform } from "../utils/platforms";
import {validateChecksum} from './checksum/checksum' import { validateChecksum } from "./checksum/checksum";
import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils' import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/utils";
export async function downloadLatest( export async function downloadLatest(
platform: Platform, platform: Platform,
arch: Architecture, arch: Architecture,
checkSum: string | undefined, checkSum: string | undefined,
githubToken: string | undefined githubToken: string | undefined,
): Promise<{cachedToolDir: string; version: string}> { ): Promise<{ cachedToolDir: string; version: string }> {
const artifact = `uv-${arch}-${platform}` const artifact = `uv-${arch}-${platform}`;
let downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/latest/download/${artifact}` let downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/latest/download/${artifact}`;
if (platform === 'pc-windows-msvc') { if (platform === "pc-windows-msvc") {
downloadUrl += '.zip' downloadUrl += ".zip";
} else { } else {
downloadUrl += '.tar.gz' downloadUrl += ".tar.gz";
} }
core.info(`Downloading uv from "${downloadUrl}" ...`) core.info(`Downloading uv from "${downloadUrl}" ...`);
const downloadPath = await tc.downloadTool( const downloadPath = await tc.downloadTool(
downloadUrl, downloadUrl,
undefined, undefined,
githubToken githubToken,
) );
let uvExecutablePath: string let uvExecutablePath: string;
let uvDir: string let uvDir: string;
if (platform === 'pc-windows-msvc') { if (platform === "pc-windows-msvc") {
uvDir = await tc.extractZip(downloadPath) uvDir = await tc.extractZip(downloadPath);
// On windows extracting the zip does not create an intermediate directory // On windows extracting the zip does not create an intermediate directory
uvExecutablePath = path.join(uvDir, 'uv.exe') uvExecutablePath = path.join(uvDir, "uv.exe");
} else { } else {
const extractedDir = await tc.extractTar(downloadPath) const extractedDir = await tc.extractTar(downloadPath);
uvDir = path.join(extractedDir, artifact) uvDir = path.join(extractedDir, artifact);
uvExecutablePath = path.join(uvDir, 'uv') uvExecutablePath = path.join(uvDir, "uv");
} }
const version = await getVersion(uvExecutablePath) const version = await getVersion(uvExecutablePath);
await validateChecksum(checkSum, downloadPath, arch, platform, version) await validateChecksum(checkSum, downloadPath, arch, platform, version);
const cachedToolDir = await tc.cacheDir(uvDir, TOOL_CACHE_NAME, version, arch) const cachedToolDir = await tc.cacheDir(
uvDir,
TOOL_CACHE_NAME,
version,
arch,
);
return {cachedToolDir, version} return { cachedToolDir, version };
} }
async function getVersion(uvExecutablePath: string): Promise<string> { async function getVersion(uvExecutablePath: string): Promise<string> {
@ -50,17 +55,17 @@ async function getVersion(uvExecutablePath: string): Promise<string> {
// uv 0.3.1 (be17d132a 2024-08-21) // uv 0.3.1 (be17d132a 2024-08-21)
const options: exec.ExecOptions = { const options: exec.ExecOptions = {
silent: !core.isDebug() silent: !core.isDebug(),
} };
const execArgs = ['--version'] const execArgs = ["--version"];
let output = '' let output = "";
options.listeners = { options.listeners = {
stdout: (data: Buffer) => { stdout: (data: Buffer) => {
output += data.toString() output += data.toString();
} },
} };
await exec.exec(uvExecutablePath, execArgs, options) await exec.exec(uvExecutablePath, execArgs, options);
const parts = output.split(' ') const parts = output.split(" ");
return parts[1] return parts[1];
} }

View file

@ -1,18 +1,18 @@
import * as core from '@actions/core' import * as core from "@actions/core";
import * as tc from '@actions/tool-cache' import * as tc from "@actions/tool-cache";
import * as path from 'path' import * as path from "path";
import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils' import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/utils";
import {Architecture, Platform} from '../utils/platforms' import { Architecture, Platform } from "../utils/platforms";
import {validateChecksum} from './checksum/checksum' import { validateChecksum } from "./checksum/checksum";
export function tryGetFromToolCache( export function tryGetFromToolCache(
arch: Architecture, arch: Architecture,
version: string version: string,
): string | undefined { ): 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(TOOL_CACHE_NAME, arch);
core.debug(`Cached versions: ${cachedVersions}`) core.debug(`Cached versions: ${cachedVersions}`);
return tc.find(TOOL_CACHE_NAME, version, arch) return tc.find(TOOL_CACHE_NAME, version, arch);
} }
export async function downloadVersion( export async function downloadVersion(
@ -20,32 +20,32 @@ export async function downloadVersion(
arch: Architecture, arch: Architecture,
version: string, version: string,
checkSum: string | undefined, checkSum: string | undefined,
githubToken: string | undefined githubToken: string | undefined,
): Promise<string> { ): Promise<string> {
const artifact = `uv-${arch}-${platform}` const artifact = `uv-${arch}-${platform}`;
let downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/download/${version}/${artifact}` let downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/download/${version}/${artifact}`;
if (platform === 'pc-windows-msvc') { if (platform === "pc-windows-msvc") {
downloadUrl += '.zip' downloadUrl += ".zip";
} else { } else {
downloadUrl += '.tar.gz' downloadUrl += ".tar.gz";
} }
core.info(`Downloading uv from "${downloadUrl}" ...`) core.info(`Downloading uv from "${downloadUrl}" ...`);
const downloadPath = await tc.downloadTool( const downloadPath = await tc.downloadTool(
downloadUrl, downloadUrl,
undefined, undefined,
githubToken githubToken,
) );
await validateChecksum(checkSum, downloadPath, arch, platform, version) await validateChecksum(checkSum, downloadPath, arch, platform, version);
let uvDir: string let uvDir: string;
if (platform === 'pc-windows-msvc') { if (platform === "pc-windows-msvc") {
uvDir = await tc.extractZip(downloadPath) uvDir = await tc.extractZip(downloadPath);
// On windows extracting the zip does not create an intermediate directory // On windows extracting the zip does not create an intermediate directory
} else { } else {
const extractedDir = await tc.extractTar(downloadPath) const extractedDir = await tc.extractTar(downloadPath);
uvDir = path.join(extractedDir, artifact) uvDir = path.join(extractedDir, artifact);
} }
return await tc.cacheDir(uvDir, TOOL_CACHE_NAME, version, arch) return await tc.cacheDir(uvDir, TOOL_CACHE_NAME, version, arch);
} }

View file

@ -1,49 +1,52 @@
import * as cache from '@actions/cache' import * as cache from "@actions/cache";
import * as core from '@actions/core' import * as core from "@actions/core";
import * as exec from '@actions/exec' import * as exec from "@actions/exec";
import {STATE_CACHE_MATCHED_KEY, STATE_CACHE_KEY} from './cache/restore-cache' import {
import {cacheLocalPath, enableCache} from './utils/inputs' STATE_CACHE_MATCHED_KEY,
STATE_CACHE_KEY,
} from "./cache/restore-cache";
import { cacheLocalPath, enableCache } from "./utils/inputs";
export async function run(): Promise<void> { export async function run(): Promise<void> {
try { try {
if (enableCache) { if (enableCache) {
await saveCache() await saveCache();
} }
} catch (error) { } catch (error) {
const err = error as Error const err = error as Error;
core.setFailed(err.message) core.setFailed(err.message);
} }
process.exit(0) process.exit(0);
} }
async function saveCache(): Promise<void> { async function saveCache(): Promise<void> {
const cacheKey = core.getState(STATE_CACHE_KEY) const cacheKey = core.getState(STATE_CACHE_KEY);
const matchedKey = core.getState(STATE_CACHE_MATCHED_KEY) const matchedKey = core.getState(STATE_CACHE_MATCHED_KEY);
if (!cacheKey) { if (!cacheKey) {
core.warning('Error retrieving cache key from state.') core.warning("Error retrieving cache key from state.");
return return;
} else if (matchedKey === cacheKey) { } else if (matchedKey === cacheKey) {
core.info(`Cache hit occurred on key ${cacheKey}, not saving cache.`) core.info(`Cache hit occurred on key ${cacheKey}, not saving cache.`);
return return;
} }
await pruneCache() await pruneCache();
core.info(`Saving cache path: ${cacheLocalPath}`) core.info(`Saving cache path: ${cacheLocalPath}`);
await cache.saveCache([cacheLocalPath], cacheKey) await cache.saveCache([cacheLocalPath], cacheKey);
core.info(`cache saved with the key: ${cacheKey}`) core.info(`cache saved with the key: ${cacheKey}`);
} }
async function pruneCache(): Promise<void> { async function pruneCache(): Promise<void> {
const options: exec.ExecOptions = { const options: exec.ExecOptions = {
silent: !core.isDebug() silent: !core.isDebug(),
} };
const execArgs = ['cache', 'prune', '--ci'] const execArgs = ["cache", "prune", "--ci"];
core.info('Pruning cache...') core.info("Pruning cache...");
await exec.exec('uv', execArgs, options) await exec.exec("uv", execArgs, options);
} }
run() run();

View file

@ -1,51 +1,59 @@
import * as core from '@actions/core' import * as core from "@actions/core";
import * as path from 'path' import * as path from "path";
import {downloadVersion, tryGetFromToolCache} from './download/download-version' import {
import {restoreCache} from './cache/restore-cache' downloadVersion,
tryGetFromToolCache,
} from "./download/download-version";
import { restoreCache } from "./cache/restore-cache";
import {downloadLatest} from './download/download-latest' import { downloadLatest } from "./download/download-latest";
import {Architecture, getArch, getPlatform, Platform} from './utils/platforms' import {
Architecture,
getArch,
getPlatform,
Platform,
} from "./utils/platforms";
import { import {
cacheLocalPath, cacheLocalPath,
checkSum, checkSum,
enableCache, enableCache,
githubToken, githubToken,
version version,
} from './utils/inputs' } from "./utils/inputs";
async function run(): Promise<void> { async function run(): Promise<void> {
const platform = getPlatform() const platform = getPlatform();
const arch = getArch() const arch = getArch();
try { try {
if (platform === undefined) { if (platform === undefined) {
throw new Error(`Unsupported platform: ${process.platform}`) throw new Error(`Unsupported platform: ${process.platform}`);
} }
if (arch === undefined) { if (arch === undefined) {
throw new Error(`Unsupported architecture: ${process.arch}`) throw new Error(`Unsupported architecture: ${process.arch}`);
} }
const setupResult = await setupUv( const setupResult = await setupUv(
platform, platform,
arch, arch,
version, version,
checkSum, checkSum,
githubToken githubToken,
) );
addUvToPath(setupResult.uvDir) addUvToPath(setupResult.uvDir);
core.setOutput('uv-version', version) core.setOutput("uv-version", version);
core.info(`Successfully installed uv version ${version}`) core.info(`Successfully installed uv version ${version}`);
addMatchers() addMatchers();
setCacheDir(cacheLocalPath) setCacheDir(cacheLocalPath);
if (enableCache) { if (enableCache) {
await restoreCache(setupResult.version) await restoreCache(setupResult.version);
} }
} catch (err) { } catch (err) {
core.setFailed((err as Error).message) core.setFailed((err as Error).message);
} }
process.exit(0) process.exit(0);
} }
async function setupUv( async function setupUv(
@ -53,47 +61,47 @@ async function setupUv(
arch: Architecture, arch: Architecture,
versionInput: string, versionInput: string,
checkSum: string | undefined, checkSum: string | undefined,
githubToken: string | undefined githubToken: string | undefined,
): Promise<{uvDir: string; version: string}> { ): Promise<{ uvDir: string; version: string }> {
let installedPath: string | undefined let installedPath: string | undefined;
let cachedToolDir: string let cachedToolDir: string;
let version: string let version: string;
if (versionInput === 'latest') { if (versionInput === "latest") {
const result = await downloadLatest(platform, arch, checkSum, githubToken) const result = await downloadLatest(platform, arch, checkSum, githubToken);
version = result.version version = result.version;
cachedToolDir = result.cachedToolDir cachedToolDir = result.cachedToolDir;
} else { } else {
version = versionInput version = versionInput;
installedPath = tryGetFromToolCache(arch, versionInput) installedPath = tryGetFromToolCache(arch, versionInput);
if (installedPath) { if (installedPath) {
core.info(`Found uv in tool-cache for ${versionInput}`) core.info(`Found uv in tool-cache for ${versionInput}`);
return {uvDir: installedPath, version} return { uvDir: installedPath, version };
} }
cachedToolDir = await downloadVersion( cachedToolDir = await downloadVersion(
platform, platform,
arch, arch,
versionInput, versionInput,
checkSum, checkSum,
githubToken githubToken,
) );
} }
return {uvDir: cachedToolDir, version} return { uvDir: cachedToolDir, version };
} }
function addUvToPath(cachedPath: string): void { function addUvToPath(cachedPath: string): void {
core.addPath(cachedPath) core.addPath(cachedPath);
core.info(`Added ${cachedPath} to the path`) core.info(`Added ${cachedPath} to the path`);
} }
function setCacheDir(cacheLocalPath: string): void { function setCacheDir(cacheLocalPath: string): void {
core.exportVariable('UV_CACHE_DIR', cacheLocalPath) core.exportVariable("UV_CACHE_DIR", cacheLocalPath);
core.info(`Set UV_CACHE_DIR to ${cacheLocalPath}`) core.info(`Set UV_CACHE_DIR to ${cacheLocalPath}`);
} }
function addMatchers(): void { function addMatchers(): void {
const matchersPath = path.join(__dirname, `..${path.sep}..`, '.github') const matchersPath = path.join(__dirname, `..${path.sep}..`, ".github");
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`) core.info(`##[add-matcher]${path.join(matchersPath, "python.json")}`);
} }
run() run();

View file

@ -1,65 +0,0 @@
import * as github from '@actions/github'
import * as core from '@actions/core'
import {OWNER, REPO} from './utils/utils'
import {createReadStream, promises as fs} from 'fs'
import * as readline from 'readline'
import * as semver from 'semver'
import {updateChecksums} from './download/checksum/update-known-checksums'
async function run(): Promise<void> {
const checksumFilePath = process.argv.slice(2)[0]
const defaultVersionFilePath = process.argv.slice(2)[1]
const github_token = process.argv.slice(2)[2]
const octokit = github.getOctokit(github_token)
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
owner: OWNER,
repo: REPO
})
const downloadUrls: string[] = response.flatMap(release =>
release.assets
.filter(asset => asset.name.endsWith('.sha256'))
.map(asset => asset.browser_download_url)
)
await updateChecksums(checksumFilePath, downloadUrls)
const latestVersion = response
.map(release => release.tag_name)
.sort(semver.rcompare)[0]
core.setOutput('latest-version', latestVersion)
await updateDefaultVersion(defaultVersionFilePath, latestVersion)
}
async function updateDefaultVersion(
filePath: string,
latestVersion: string
): Promise<void> {
const fileStream = createReadStream(filePath)
const rl = readline.createInterface({
input: fileStream
})
let foundDescription = false
const lines = []
for await (let line of rl) {
if (
!foundDescription &&
line.includes("description: 'The version of uv to install'")
) {
foundDescription = true
} else if (foundDescription && line.includes('default: ')) {
line = line.replace(/'[^']*'/, `'${latestVersion}'`)
foundDescription = false
}
lines.push(line)
}
await fs.writeFile(filePath, lines.join('\n'))
}
run()

View file

@ -0,0 +1,32 @@
import * as github from "@actions/github";
import * as core from "@actions/core";
import { OWNER, REPO } from "./utils/utils";
import * as semver from "semver";
import { updateChecksums } from "./download/checksum/update-known-checksums";
async function run(): Promise<void> {
const checksumFilePath = process.argv.slice(2)[0];
const github_token = process.argv.slice(2)[1];
const octokit = github.getOctokit(github_token);
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
owner: OWNER,
repo: REPO,
});
const downloadUrls: string[] = response.flatMap((release) =>
release.assets
.filter((asset) => asset.name.endsWith(".sha256"))
.map((asset) => asset.browser_download_url),
);
await updateChecksums(checksumFilePath, downloadUrls);
const latestVersion = response
.map((release) => release.tag_name)
.sort(semver.rcompare)[0];
core.setOutput("latest-version", latestVersion);
}
run();

View file

@ -1,9 +1,9 @@
import * as core from '@actions/core' import * as core from "@actions/core";
export const version = core.getInput('version') export const version = core.getInput("version");
export const checkSum = core.getInput('checksum') export const checkSum = core.getInput("checksum");
export const enableCache = core.getInput('enable-cache') === 'true' export const enableCache = core.getInput("enable-cache") === "true";
export const cacheSuffix = core.getInput('cache-suffix') || '' export const cacheSuffix = core.getInput("cache-suffix") || "";
export const cacheLocalPath = core.getInput('cache-local-path') export const cacheLocalPath = core.getInput("cache-local-path");
export const githubToken = core.getInput('github-token') export const githubToken = core.getInput("github-token");
export const cacheDependencyGlob = core.getInput('cache-dependency-glob') export const cacheDependencyGlob = core.getInput("cache-dependency-glob");

View file

@ -1,33 +1,33 @@
export type Platform = export type Platform =
| 'unknown-linux-gnu' | "unknown-linux-gnu"
| 'unknown-linux-musl' | "unknown-linux-musl"
| 'unknown-linux-musleabihf' | "unknown-linux-musleabihf"
| 'apple-darwin' | "apple-darwin"
| 'pc-windows-msvc' | "pc-windows-msvc";
export type Architecture = 'i686' | 'x86_64' | 'aarch64' export type Architecture = "i686" | "x86_64" | "aarch64";
export function getArch(): Architecture | undefined { export function getArch(): Architecture | undefined {
const arch = process.arch const arch = process.arch;
const archMapping: {[key: string]: Architecture} = { const archMapping: { [key: string]: Architecture } = {
ia32: 'i686', ia32: "i686",
x64: 'x86_64', x64: "x86_64",
arm64: 'aarch64' arm64: "aarch64",
} };
if (arch in archMapping) { if (arch in archMapping) {
return archMapping[arch] return archMapping[arch];
} }
} }
export function getPlatform(): Platform | undefined { export function getPlatform(): Platform | undefined {
const platform = process.platform const platform = process.platform;
const platformMapping: {[key: string]: Platform} = { const platformMapping: { [key: string]: Platform } = {
linux: 'unknown-linux-gnu', linux: "unknown-linux-gnu",
darwin: 'apple-darwin', darwin: "apple-darwin",
win32: 'pc-windows-msvc' win32: "pc-windows-msvc",
} };
if (platform in platformMapping) { if (platform in platformMapping) {
return platformMapping[platform] return platformMapping[platform];
} }
} }

View file

@ -1,3 +1,3 @@
export const REPO = 'uv' export const REPO = "uv";
export const OWNER = 'astral-sh' export const OWNER = "astral-sh";
export const TOOL_CACHE_NAME = 'uv' export const TOOL_CACHE_NAME = "uv";

View file

@ -1,11 +1,11 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"outDir": "./lib", /* Redirect output structure to the directory. */ "outDir": "./lib" /* Redirect output structure to the directory. */,
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
"strict": true, /* Enable all strict type-checking options. */ "strict": true /* Enable all strict type-checking options. */,
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
}, },
"exclude": ["node_modules", "**/*.test.ts"] "exclude": ["node_modules", "**/*.test.ts"]