Skip to content

Commit 814bb91

Browse files
authored
Replace requirements-command with command across workflows, docs, and scripts (#9)
1 parent 2510b04 commit 814bb91

4 files changed

Lines changed: 28 additions & 28 deletions

File tree

.github/workflows/test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
export PATH="$HOME/.local/bin:$PATH"
7474
uv sync
7575
76-
- name: Test with default uv sync command (no requirements-command specified)
76+
- name: Test with default uv sync command (no command specified)
7777
uses: ./
7878
with:
7979
pyproject-path: test-project/pyproject.toml
@@ -115,7 +115,7 @@ jobs:
115115
with:
116116
pyproject-path: test-project/pyproject.toml
117117
requirements-path: test-project/requirements.txt
118-
requirements-command: uv pip compile pyproject.toml -o requirements.txt
118+
command: uv pip compile pyproject.toml -o requirements.txt
119119

120120
test-custom-requirements:
121121
runs-on: ubuntu-latest
@@ -153,7 +153,7 @@ jobs:
153153
with:
154154
pyproject-path: test-project/pyproject.toml
155155
requirements-path: test-project/requirements-linux.txt
156-
requirements-command: uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt
156+
command: uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt
157157

158158
test-requirements-failure:
159159
runs-on: ubuntu-latest
@@ -170,7 +170,7 @@ jobs:
170170
with:
171171
pyproject-path: ./test-fixtures/requirements-out-of-sync/pyproject.toml
172172
requirements-path: ./test-fixtures/requirements-out-of-sync/requirements.txt
173-
requirements-command: uv pip compile ./test-fixtures/requirements-out-of-sync/pyproject.toml -o ./test-fixtures/requirements-out-of-sync/requirements.txt
173+
command: uv pip compile ./test-fixtures/requirements-out-of-sync/pyproject.toml -o ./test-fixtures/requirements-out-of-sync/requirements.txt
174174
- name: Assert action failed
175175
run: |
176176
if [[ "${{ steps.action_step.outcome }}" == "success" ]]; then
@@ -221,13 +221,13 @@ jobs:
221221
uses: ./
222222
with:
223223
pyproject-path: test-project/pyproject.toml
224-
requirements-command: uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt
224+
command: uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt
225225
requirements-path: test-project/requirements-linux.txt
226226
- name: Check Windows Requirements
227227
uses: ./
228228
with:
229229
pyproject-path: test-project/pyproject.toml
230-
requirements-command: uv pip compile --python-platform=windows pyproject.toml -o requirements-win.txt
230+
command: uv pip compile --python-platform=windows pyproject.toml -o requirements-win.txt
231231
requirements-path: test-project/requirements-win.txt
232232

233233
test-failure:
@@ -245,7 +245,7 @@ jobs:
245245
with:
246246
pyproject-path: ./test-fixtures/uv-lock-out-of-sync/pyproject.toml
247247
requirements-path: ./test-fixtures/uv-lock-out-of-sync/requirements.txt
248-
requirements-command: uv pip compile ./test-fixtures/uv-lock-out-of-sync/pyproject.toml -o ./test-fixtures/uv-lock-out-of-sync/requirements.txt
248+
command: uv pip compile ./test-fixtures/uv-lock-out-of-sync/pyproject.toml -o ./test-fixtures/uv-lock-out-of-sync/requirements.txt
249249
- name: Assert action failed
250250
run: |
251251
if [[ "${{ steps.action_step.outcome }}" == "success" ]]; then
@@ -273,4 +273,4 @@ jobs:
273273
uses: ./
274274
with:
275275
pyproject-path: ./test-fixtures/python-version-tilde/pyproject.toml
276-
requirements-command: uv sync --directory ./test-fixtures/python-version-tilde
276+
command: uv sync --directory ./test-fixtures/python-version-tilde

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,22 @@ jobs:
4141
requirements-path: 'path/to/requirements.txt'
4242
```
4343
44-
### With Custom Requirements Command
44+
### With Custom Command
4545
4646
```yaml
4747
- uses: hbelmiro/uv-lock-check@v1
4848
with:
49-
requirements-command: 'uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt'
49+
command: 'uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt'
5050
requirements-path: 'requirements-linux.txt'
5151
```
5252
5353
## Inputs
5454
55-
| Input | Description | Required | Default |
56-
|-------|-------------|----------|---------|
57-
| `pyproject-path` | Path to the pyproject.toml file | No | `pyproject.toml` |
58-
| `requirements-path` | Path to the requirements.txt file. If empty, will look for requirements.txt in the same directory as pyproject.toml | No | `''` |
59-
| `requirements-command` | Complete uv command to generate requirements.txt | No | `uv sync` |
55+
| Input | Description | Required | Default |
56+
|---------------------|---------------------------------------------------------------------------------------------------------------------|----------|------------------|
57+
| `pyproject-path` | Path to the pyproject.toml file | No | `pyproject.toml` |
58+
| `requirements-path` | Path to the requirements.txt file. If empty, will look for requirements.txt in the same directory as pyproject.toml | No | `''` |
59+
| `command` | uv command to run for validation | No | `uv sync` |
6060

6161
## How It Works
6262

@@ -74,7 +74,7 @@ jobs:
7474
```yaml
7575
- uses: hbelmiro/uv-lock-check@v1
7676
with:
77-
requirements-command: 'uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt'
77+
command: 'uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt'
7878
requirements-path: 'requirements-linux.txt'
7979
```
8080

@@ -84,13 +84,13 @@ jobs:
8484
- name: Check Linux Requirements
8585
uses: hbelmiro/uv-lock-check@v1
8686
with:
87-
requirements-command: 'uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt'
87+
command: 'uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt'
8888
requirements-path: 'requirements-linux.txt'
8989
9090
- name: Check Windows Requirements
9191
uses: hbelmiro/uv-lock-check@v1
9292
with:
93-
requirements-command: 'uv pip compile --python-platform=windows pyproject.toml -o requirements-win.txt'
93+
command: 'uv pip compile --python-platform=windows pyproject.toml -o requirements-win.txt'
9494
requirements-path: 'requirements-win.txt'
9595
```
9696

action.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ inputs:
1313
description: 'Path to the requirements.txt file. If empty, will look for requirements.txt in the same directory as pyproject.toml'
1414
required: false
1515
default: ''
16-
requirements-command:
17-
description: 'Complete uv command to generate requirements.txt (e.g., "uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt")'
16+
command:
17+
description: 'uv command to run for validation (e.g., "uv sync" for lock files, "uv pip compile pyproject.toml -o requirements.txt" for requirements)'
1818
required: false
1919
default: 'uv sync'
2020
run-sync:
@@ -65,12 +65,12 @@ runs:
6565
run: |
6666
uv sync
6767
if [ -f "${{ env.REQUIREMENTS_PATH }}" ]; then
68-
${{ inputs.requirements-command }}
68+
${{ inputs.command }}
6969
fi
7070
7171
- name: Verify files
7272
shell: bash
7373
working-directory: ${{ env.PYPROJECT_DIR }}
7474
env:
75-
SYNC_COMMAND: ${{ inputs.requirements-command }}
75+
COMMAND: ${{ inputs.command }}
7676
run: $GITHUB_ACTION_PATH/verify.sh

verify.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ set -euo pipefail
44

55
# Always resolve relative to the repo root (GITHUB_WORKSPACE or git rev-parse fallback)
66
REPO_ROOT="${GITHUB_WORKSPACE:-$(git rev-parse --show-toplevel 2>/dev/null)}"
7-
if [[ "$SYNC_COMMAND" =~ --directory[=\ ]([^ ]+) ]]; then
7+
if [[ "$COMMAND" =~ --directory[=\ ]([^ ]+) ]]; then
88
DIR_ARG="${BASH_REMATCH[1]}"
99
# If DIR_ARG is not absolute, make it absolute relative to repo root
1010
if [[ ! "$DIR_ARG" = /* ]]; then
1111
ABS_DIR_ARG="$REPO_ROOT/$DIR_ARG"
12-
SYNC_COMMAND="${SYNC_COMMAND/--directory $DIR_ARG/--directory $ABS_DIR_ARG}"
13-
SYNC_COMMAND="${SYNC_COMMAND/--directory=$DIR_ARG/--directory=$ABS_DIR_ARG}"
12+
COMMAND="${COMMAND/--directory $DIR_ARG/--directory $ABS_DIR_ARG}"
13+
COMMAND="${COMMAND/--directory=$DIR_ARG/--directory=$ABS_DIR_ARG}"
1414
fi
1515
fi
1616

17-
echo "Resolved SYNC_COMMAND: $SYNC_COMMAND"
18-
echo "Running sync command: $SYNC_COMMAND"
19-
eval "$SYNC_COMMAND"
17+
echo "Resolved COMMAND: $COMMAND"
18+
echo "Running command: $COMMAND"
19+
eval "$COMMAND"
2020

2121
# Check if any existing files have been modified
2222
if ! git diff --exit-code --quiet; then

0 commit comments

Comments
 (0)