Skip to content

Commit 9b2efb7

Browse files
authored
Add support for pep440 version specifiers (#150)
Fixes: #147
1 parent da0c801 commit 9b2efb7

6 files changed

Lines changed: 856 additions & 7 deletions

File tree

.github/workflows/test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,23 @@ jobs:
203203
fi
204204
env:
205205
RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }}
206+
test-pep440-version-specifier:
207+
runs-on: ubuntu-latest
208+
steps:
209+
- uses: actions/checkout@v4
210+
- name: Install version 0.11.11
211+
id: ruff-action
212+
uses: ./
213+
with:
214+
version: ">=0.11.10,<0.12.0"
215+
src: __tests__/fixtures/python-project
216+
- name: Correct version gets installed
217+
run: |
218+
if [ "$RUFF_VERSION" != "0.11.11" ]; then
219+
exit 1
220+
fi
221+
env:
222+
RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }}
206223
test-checksum:
207224
runs-on: ${{ matrix.inputs.os }}
208225
strategy:
@@ -298,6 +315,7 @@ jobs:
298315
- test-default-version-from-pyproject-optional-dependencies
299316
- test-default-version-from-requirements
300317
- test-semver-range
318+
- test-pep440-version-specifier
301319
- test-checksum
302320
- test-with-explicit-token
303321
- test-args

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A GitHub Action to run [ruff](https://github.com/astral-sh/ruff).
44

55
This action is commonly used as a pass/fail test to ensure your repository stays
66
clean, abiding the [rules](https://docs.astral.sh/ruff/rules/) specified in your
7-
configuration. Though it runs `ruff check` by default, the action can do
7+
configuration. Though it runs `ruff check` by default, the action can do
88
anything `ruff` can (ex, fix).
99

1010
## Contents
@@ -18,7 +18,7 @@ anything `ruff` can (ex, fix).
1818
- [Install specific versions](#install-specific-versions)
1919
- [Install the latest version](#install-the-latest-version)
2020
- [Install a specific version](#install-a-specific-version)
21-
- [Install a version by supplying a semver range](#install-a-version-by-supplying-a-semver-range)
21+
- [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)
2323
- [Validate checksum](#validate-checksum)
2424
- [GitHub authentication token](#github-authentication-token)
@@ -116,9 +116,10 @@ the latest version is installed.
116116
version: "0.4.4"
117117
```
118118

119-
#### Install a version by supplying a semver range
119+
#### Install a version by supplying a semver range or pep440 specifier
120120

121121
You can specify a [semver range](https://github.com/npm/node-semver?tab=readme-ov-file#ranges)
122+
or [pep440 specifier](https://peps.python.org/pep-0440/#version-specifiers)
122123
to install the latest version that satisfies the range.
123124

124125
```yaml
@@ -135,6 +136,13 @@ to install the latest version that satisfies the range.
135136
version: "0.4.x"
136137
```
137138

139+
```yaml
140+
- name: Install a pep440-specifier-satisfying version of ruff
141+
uses: astral-sh/ruff-action@v3
142+
with:
143+
version: ">=0.11.10,<0.12.0"
144+
```
145+
138146
#### Install a version from a specified version file
139147

140148
You can specify a file to read the version from.

0 commit comments

Comments
 (0)