From 2b2270ac72eab1e51ed83c9135578a957a36fab9 Mon Sep 17 00:00:00 2001 From: HammerZhaoTuro <144160842+HammerZhaoTuro@users.noreply.github.com> Date: Wed, 15 Jul 2026 18:32:14 +0000 Subject: [PATCH 1/2] fix: make setup-node conditional to preserve baked pre-commit cache Skip `actions/setup-node` when `node` is already on PATH, matching the existing pattern for Python. This prevents setup-node from installing a different Node version that changes pre-commit's cache key, causing baked hook environments (e.g. mirrors-prettier) to miss and reinstall from scratch on every run. Co-Authored-By: Claude Opus 4.6 (1M context) --- action.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/action.yaml b/action.yaml index fad2dfa..0f3a5c1 100644 --- a/action.yaml +++ b/action.yaml @@ -68,11 +68,19 @@ runs: # install python. PYTHON_BIN=$(command -v python || true) echo "PYTHON_BIN=$PYTHON_BIN" >> $GITHUB_ENV + + # Finding node + # Skip setup-node when the runner image already has node, so + # pre-commit's baked hook environments (keyed on the system node + # path) are not invalidated by a different node landing on PATH. + NODE_BIN=$(command -v node || true) + echo "NODE_BIN=$NODE_BIN" >> $GITHUB_ENV - name: Setup python # Only run this if we don't already have a pre-commit on the PATH if: env.PYTHON_BIN == null && env.PRE_COMMIT_BIN == null && steps.pre-commit-config.outputs.exists != 'false' uses: actions/setup-python@v6 - name: Determine node version + if: env.NODE_BIN == '' id: node-version shell: bash run: | @@ -88,6 +96,7 @@ runs: echo "version=24" >> $GITHUB_OUTPUT fi - name: Setup node + if: env.NODE_BIN == '' uses: actions/setup-node@v6 with: node-version: ${{ steps.node-version.outputs.version }} From d13819f3982862a4f7850223a97515d2c3b39b6a Mon Sep 17 00:00:00 2001 From: HammerZhaoTuro <144160842+HammerZhaoTuro@users.noreply.github.com> Date: Wed, 15 Jul 2026 19:51:19 +0000 Subject: [PATCH 2/2] test: point commitlint sub-action to feature branch Avoids double action download during testing. Will be updated to @v4 when the release is cut. Co-Authored-By: Claude Opus 4.6 (1M context) --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 0f3a5c1..6af441b 100644 --- a/action.yaml +++ b/action.yaml @@ -103,7 +103,7 @@ runs: - name: Commitlint # This version needs to be sync'd with the repo HEAD if a major version is cut if: inputs.disable-commitlint != 'true' - uses: open-turo/action-pre-commit/commitlint@v3 + uses: open-turo/action-pre-commit/commitlint@f/devex-907_make_setup-node_conditional_in_action-pre-commit_to_preserve_baked_pre-c with: restore-config: "false" config-file: ${{ inputs.config-file }}