Skip to content

Commit 6df268a

Browse files
fix: both ap-commit hooks now put the project's .venv on PATH themselves and call ap directly
1 parent 227d3f6 commit 6df268a

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
- main # Deploy when pushing to main branch
77
paths:
88
# Trigger deployment only when content or website files change
9+
# Code changes (src/) don't trigger it, so a docstring change doesn't update the API reference (pdoc).
10+
# To update it, run this workflow manually (Actions tab, workflow_dispatch).
911
- 'afterpython/doc/**'
1012
- 'afterpython/blog/**'
1113
- 'afterpython/tutorial/**'

‎afterpython/.pre-commit-config.yaml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ repos:
4343
- repo: local
4444
hooks:
4545
# same id twice so that SKIP=ap-commit skips both
46+
# git GUIs run hooks with a minimal PATH (no uv/venv), so put the project venv on PATH ourselves
4647
- id: ap-commit
4748
name: commit message template
48-
entry: uv run --no-sync ap commit-msg --template
49+
entry: sh -c 'PATH="$PWD/.venv/bin:$PWD/.venv/Scripts:$PATH" exec ap commit-msg --template "$@"' --
4950
language: system
5051
stages:
5152
- prepare-commit-msg
5253
- id: ap-commit
5354
name: check commit message
54-
entry: uv run --no-sync ap commit-msg
55+
entry: sh -c 'PATH="$PWD/.venv/bin:$PWD/.venv/Scripts:$PATH" exec ap commit-msg "$@"' --
5556
language: system
5657
stages:
5758
- commit-msg

‎src/afterpython/templates/deploy-workflow-template.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
- main # Deploy when pushing to main branch
77
paths:
88
# Trigger deployment only when content or website files change
9+
# Code changes (src/) don't trigger it, so a docstring change doesn't update the API reference (pdoc).
10+
# To update it, run this workflow manually (Actions tab, workflow_dispatch).
911
- 'afterpython/doc/**'
1012
- 'afterpython/blog/**'
1113
- 'afterpython/tutorial/**'

‎src/afterpython/templates/pre-commit-config-template.yaml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ repos:
4141
- repo: local
4242
hooks:
4343
# same id twice so that SKIP=ap-commit skips both
44+
# git GUIs run hooks with a minimal PATH (no uv/venv), so put the project venv on PATH ourselves
4445
- id: ap-commit
4546
name: commit message template
46-
entry: uv run --no-sync ap commit-msg --template
47+
entry: sh -c 'PATH="$PWD/.venv/bin:$PWD/.venv/Scripts:$PATH" exec ap commit-msg --template "$@"' --
4748
language: system
4849
stages:
4950
- prepare-commit-msg
5051
- id: ap-commit
5152
name: check commit message
52-
entry: uv run --no-sync ap commit-msg
53+
entry: sh -c 'PATH="$PWD/.venv/bin:$PWD/.venv/Scripts:$PATH" exec ap commit-msg "$@"' --
5354
language: system
5455
stages:
5556
- commit-msg

0 commit comments

Comments
 (0)