Skip to content

fix(ci): skip no-commit-to-branch for pre-commit run on main#43

Merged
buddingengineers12345 merged 1 commit intomainfrom
fix/skip-no-commit-to-branch-ci
Apr 17, 2026
Merged

fix(ci): skip no-commit-to-branch for pre-commit run on main#43
buddingengineers12345 merged 1 commit intomainfrom
fix/skip-no-commit-to-branch-ci

Conversation

@buddingengineers12345
Copy link
Copy Markdown
Owner

Summary

no-commit-to-branch correctly blocks direct commits to main/master, but it also runs during pre-commit run --all-files. When CI checks out main (e.g. after a merge) or a developer runs just check/just precommit on main, that hook fails even though no commit is being made.

Changes

  • lint.yml and template ci.yml.jinja: set SKIP: no-commit-to-branch on the Pre-commit (all files) step only.
  • justfile and template justfile.jinja: prefix precommit and check pre-commit lines with SKIP=no-commit-to-branch.
  • tests: assert SKIP appears in generated ci.yml and justfile.

Direct git commit on main still runs the hook unless SKIP is exported in the shell.

Verification

  • pytest tests/integration/test_template.py::test_ci_workflow_aligns_with_just_ci
  • uv run python scripts/check_root_template_sync.py
  • just precommit on main (hook skipped; other hooks unchanged)

Made with Cursor

The hook fails when HEAD is main/master, which breaks lint.yml on push
to main and local just check/precommit on main. Set SKIP only for
pre-commit run invocations; git commit still runs the hook unless SKIP
is exported in the shell.

- lint.yml and template ci.yml.jinja: env SKIP on pre-commit step
- justfile and template: SKIP on precommit and check recipes
- Integration test asserts SKIP in generated ci.yml and justfile

Made-with: Cursor
@github-actions github-actions bot added dependencies Pull requests that update a dependency file ci template tests build labels Apr 17, 2026
@buddingengineers12345 buddingengineers12345 merged commit 29c0a28 into main Apr 17, 2026
9 checks passed
@buddingengineers12345 buddingengineers12345 deleted the fix/skip-no-commit-to-branch-ci branch April 17, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build ci dependencies Pull requests that update a dependency file template tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants