Skip to content

Commit 9b8caf6

Browse files
authored
Add manifest-file input (#352)
1 parent 535554d commit 9b8caf6

16 files changed

Lines changed: 2126 additions & 4210 deletions

File tree

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,31 @@ jobs:
431431
env:
432432
RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }}
433433

434+
test-custom-manifest-file:
435+
runs-on: ubuntu-latest
436+
steps:
437+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
438+
with:
439+
persist-credentials: false
440+
- name: Create test src
441+
run: |
442+
mkdir -p "${{ runner.temp }}/ruff-manifest-test"
443+
printf 'print("hello")\n' > "${{ runner.temp }}/ruff-manifest-test/hello.py"
444+
- name: Install from custom manifest file
445+
id: ruff-action
446+
uses: ./
447+
with:
448+
src: ${{ runner.temp }}/ruff-manifest-test
449+
manifest-file: "https://raw.githubusercontent.com/astral-sh/ruff-action/${{ github.ref }}/__tests__/download/custom-manifest.ndjson"
450+
- name: Correct version gets installed
451+
run: |
452+
if [ "$RUFF_VERSION" != "0.15.10" ]; then
453+
echo "Wrong ruff version: $RUFF_VERSION"
454+
exit 1
455+
fi
456+
env:
457+
RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }}
458+
434459
all-tests-passed:
435460
runs-on: ubuntu-latest
436461
needs:
@@ -456,6 +481,7 @@ jobs:
456481
- test-failure
457482
- test-multiple-src
458483
- test-parent-directory-pyproject
484+
- test-custom-manifest-file
459485
if: always()
460486
steps:
461487
- name: All tests passed

README.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,25 @@ anything `ruff` can (ex, fix).
2020
- [Install a specific version](#install-a-specific-version)
2121
- [Install a version by supplying a semver range or pep440 specifier](#install-a-version-by-supplying-a-semver-range-or-pep440-specifier)
2222
- [Install a version from a specified version file](#install-a-version-from-a-specified-version-file)
23+
- [Install using a custom manifest URL](#install-using-a-custom-manifest-url)
2324
- [Validate checksum](#validate-checksum)
2425
- [GitHub authentication token](#github-authentication-token)
2526
- [Outputs](#outputs)
2627

2728
## Usage
2829

29-
| Input | Description | Default |
30-
|----------------|--------------------------------------------------------------------------------------------------------------------------------------------|--------------------|
31-
| `version` | The version of Ruff to install. See [Install specific versions](#install-specific-versions) | `latest` |
32-
| `version-file` | The file to read the version from. See [Install a version from a specified version file](#install-a-version-from-a-specified-version-file) | None |
33-
| `args` | The arguments to pass to the `ruff` command. See [Configuring Ruff] | `check` |
34-
| `src` | The directory or single files to run `ruff` on. | [github.workspace] |
35-
| `checksum` | The sha256 checksum of the downloaded executable. | None |
36-
| `github-token` | The GitHub token to use for authentication. | `GITHUB_TOKEN` |
30+
| Input | Description | Default |
31+
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------|--------------------|
32+
| `version` | The version of Ruff to install. See [Install specific versions](#install-specific-versions) | `latest` |
33+
| `version-file` | The file to read the version from. See [Install a version from a specified version file](#install-a-version-from-a-specified-version-file) | None |
34+
| `manifest-file` | URL to a custom Ruff manifest in the `astral-sh/versions` format. | None |
35+
| `args` | The arguments to pass to the `ruff` command. See [Configuring Ruff] | `check` |
36+
| `src` | The directory or single files to run `ruff` on. | [github.workspace] |
37+
| `checksum` | The sha256 checksum of the downloaded artifact. | None |
38+
| `github-token` | The GitHub token to use when downloading Ruff release artifacts from GitHub. | `GITHUB_TOKEN` |
39+
40+
By default, Ruff version metadata is resolved from the
41+
[`astral-sh/versions` Ruff manifest](https://github.com/astral-sh/versions/blob/main/v1/ruff.ndjson).
3742

3843
### Basic
3944

@@ -155,6 +160,19 @@ Currently `pyproject.toml` and `requirements.txt` are supported.
155160
version-file: "my-path/to/pyproject.toml-or-requirements.txt"
156161
```
157162

163+
#### Install using a custom manifest URL
164+
165+
You can override the default `astral-sh/versions` manifest with `manifest-file`.
166+
This affects both version resolution and artifact selection.
167+
168+
```yaml
169+
- name: Install Ruff from a custom manifest
170+
uses: astral-sh/ruff-action@v3
171+
with:
172+
version: "latest"
173+
manifest-file: "https://example.com/ruff.ndjson"
174+
```
175+
158176
### Validate checksum
159177

160178
You can specify a checksum to validate the downloaded executable. Checksums up to the default version
@@ -171,9 +189,11 @@ are automatically verified by this action. The sha256 hashes can be found on the
171189

172190
### GitHub authentication token
173191

174-
This action uses the GitHub API to fetch the ruff release artifacts. To avoid hitting the GitHub API
175-
rate limit too quickly, an authentication token can be provided via the `github-token` input. By
176-
default, the `GITHUB_TOKEN` secret is used, which is automatically provided by GitHub Actions.
192+
By default, this action resolves available uv versions from
193+
[`astral-sh/versions`](https://github.com/astral-sh/versions) and downloads release artifacts from `https://releases.astral.sh`. If this fails this action falls back to downloading from the GitHub releases page of the ruff repository.
194+
195+
You can provide a token via `github-token` to authenticate those downloads. By default, the
196+
`GITHUB_TOKEN` secret is used, which is automatically provided by GitHub Actions.
177197

178198
If the default
179199
[permissions for the GitHub token](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#permissions-for-the-github_token)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"0.15.10","artifacts":[{"platform":"x86_64-unknown-linux-gnu","variant":"default","url":"https://github.com/astral-sh/ruff/releases/download/0.15.10/ruff-x86_64-unknown-linux-gnu.tar.gz","archive_format":"tar.gz","sha256":"e3e9e5c791542f00d95edc74a506e1ac24efc0af9574de01ab338187bf1ff9f6"}]}

0 commit comments

Comments
 (0)