From f2b4d717c2a05e0f5cd1d5ee005225aeb895f846 Mon Sep 17 00:00:00 2001 From: Steve Miller Date: Fri, 4 Sep 2026 13:53:00 +0000 Subject: [PATCH] ci: skip the branch protection hook when pre-commit runs in CI The no-commit-to-branch hook exists to stop local commits on main. The Build Tests workflow runs pre-commit on main after a merge, where the hook fails by design and marks the run red although nothing is wrong. Skip it for the CI run only. --- .github/actions/pre-commit/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/pre-commit/action.yml b/.github/actions/pre-commit/action.yml index 5bd677b7..dfdf25e7 100644 --- a/.github/actions/pre-commit/action.yml +++ b/.github/actions/pre-commit/action.yml @@ -32,3 +32,6 @@ runs: key: pre-commit-3|${{ env.PYTHON_PATH }}|${{ runner.arch }}|${{ hashFiles('.pre-commit-config.yaml') }} - run: pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }} shell: bash + env: + # the hook guards local commits on protected branches; a workflow running on main is not one + SKIP: no-commit-to-branch