diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 59fcdc9..6df4a59 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -59,5 +59,9 @@ jobs: - name: Root/template sync policy check run: uv run python scripts/check_root_template_sync.py + # no-commit-to-branch blocks direct commits to main; SKIP avoids false failures when + # checkout is on main (e.g. post-merge push) while still running the hook on git commit. - name: Pre-commit (all files) + env: + SKIP: no-commit-to-branch run: uv run pre-commit run --all-files diff --git a/justfile b/justfile index b936d00..1eeca1f 100644 --- a/justfile +++ b/justfile @@ -172,7 +172,7 @@ cz-commit: @uv run cz commit precommit: - @uv run pre-commit run --all-files + @SKIP=no-commit-to-branch uv run pre-commit run --all-files # Dependency audit matching .github/workflows/security.yml (pip-audit). # Uses ``uv run --with pip-audit`` so the tool runs with the project Python (``uv tool run``/``uvx`` @@ -274,7 +274,7 @@ check: @just sync-check @just docs-check @just test-ci - @uv run pre-commit run --all-files + @SKIP=no-commit-to-branch uv run pre-commit run --all-files # @just audit ci: @@ -324,9 +324,9 @@ doctor: # - Push permissions to main branch # # Usage: -# just release patch # v0.0.8 → v0.0.9 (bug fixes) -# just release minor # v0.0.8 → v0.1.0 (new features) -# just release major # v0.0.8 → v1.0.0 (breaking changes) +# just release patch # v0.0.9 → v0.0.10 (bug fixes) +# just release minor # v0.0.9 → v0.1.0 (new features) +# just release major # v0.0.9 → v1.0.0 (breaking changes) release BUMP_TYPE="patch": @echo "=== Release Workflow ===" @echo "Release type: {{BUMP_TYPE}}" diff --git a/pyproject.toml b/pyproject.toml index 3250e53..5e638e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "python_project_template" -version = "0.0.8" +version = "0.0.9" description = "Copier template repository for generating uv-first Python projects." readme = "README.md" requires-python = ">=3.11" diff --git a/template/.github/workflows/ci.yml.jinja b/template/.github/workflows/ci.yml.jinja index 17d7806..7777570 100644 --- a/template/.github/workflows/ci.yml.jinja +++ b/template/.github/workflows/ci.yml.jinja @@ -88,7 +88,11 @@ jobs: - name: Install dependencies run: uv sync --frozen --extra dev --extra test{% if include_docs %} --extra docs{% endif %} + # no-commit-to-branch blocks direct commits to main; SKIP avoids false failures when + # checkout is on main (e.g. post-merge push) while still running the hook on git commit. - name: Pre-commit (all files) + env: + SKIP: no-commit-to-branch run: uv run pre-commit run --all-files test: diff --git a/template/justfile.jinja b/template/justfile.jinja index 9a7c839..9550867 100644 --- a/template/justfile.jinja +++ b/template/justfile.jinja @@ -149,7 +149,7 @@ cz-commit: @uv run cz commit precommit: - @uv run pre-commit run --all-files + @SKIP=no-commit-to-branch uv run pre-commit run --all-files # Dependency audit matching .github/workflows/security.yml (pip-audit). # Uses ``uv run --with pip-audit`` so the tool runs with the project Python (``uv tool run``/``uvx`` @@ -266,7 +266,7 @@ check: @uv run basedpyright @just docs-check @just test-ci - @uv run pre-commit run --all-files + @SKIP=no-commit-to-branch uv run pre-commit run --all-files ci: @just fix diff --git a/tests/integration/test_template.py b/tests/integration/test_template.py index 09aec37..e3f13fe 100644 --- a/tests/integration/test_template.py +++ b/tests/integration/test_template.py @@ -1568,6 +1568,7 @@ def test_ci_workflow_aligns_with_just_ci(tmp_path: Path) -> None: "Aggregate check must gate on pre-commit alongside lint, typecheck, and tests" ) assert "uv run pre-commit run --all-files" in workflow + assert "SKIP: no-commit-to-branch" in workflow assert "uv run ruff format --check src tests" in workflow assert "uv run ruff check src tests" in workflow assert ( @@ -1582,6 +1583,7 @@ def test_ci_workflow_aligns_with_just_ci(tmp_path: Path) -> None: in justfile ) assert "@just test-ci" in justfile + assert "SKIP=no-commit-to-branch uv run pre-commit run --all-files" in justfile lint_yml = (test_dir / ".github" / "workflows" / "lint.yml").read_text(encoding="utf-8") assert "uv run ruff format --check src tests" in lint_yml diff --git a/uv.lock b/uv.lock index fcc6eab..238e08c 100644 --- a/uv.lock +++ b/uv.lock @@ -868,7 +868,7 @@ wheels = [ [[package]] name = "python-project-template" -version = "0.0.8" +version = "0.0.9" source = { virtual = "." } [package.optional-dependencies]