From 22291de9d8289198ac4b09f069dcfac43f087b57 Mon Sep 17 00:00:00 2001 From: Jakob Heuser Date: Sun, 1 Nov 2026 19:00:56 -0800 Subject: [PATCH] chore: skip the pre-commit guard block on GitHub Actions Repos that install the worktrees-pnpm skill through dotagents skip that install under CI, so on a runner the guard file may not exist, and the missing-file check from #603 would block every automated commit before the guard's own GITHUB_ACTIONS skip could run. taskless/marketing#88's review caught it; taskless/taskless#426 carries the same fix. taskless/cli tracks the guard in git, so it is always present here, but the body is adopted anyway so all three repos run one byte-identical hook, and the skill documents why the check sits inside the test. --- .agents/skills/worktrees-pnpm/SKILL.md | 18 ++++++++++++------ .husky/pre-commit | 14 +++++++++----- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.agents/skills/worktrees-pnpm/SKILL.md b/.agents/skills/worktrees-pnpm/SKILL.md index 946be392..05a55997 100644 --- a/.agents/skills/worktrees-pnpm/SKILL.md +++ b/.agents/skills/worktrees-pnpm/SKILL.md @@ -157,19 +157,25 @@ another CI system adds that system's own marker. With Husky, run it first in share: ```sh -guard=.agents/skills/worktrees-pnpm/scripts/refuse-main-checkout.sh -if [ ! -f "$guard" ]; then - echo "pre-commit: $guard is missing. Run pnpm install (or pnpm dotagents install) first." >&2 - exit 1 +# GitHub Actions skips the dotagents install (postinstall checks CI), so the +# skill's guard may be absent there; the guard exempts Actions anyway. +if [ "${GITHUB_ACTIONS:-}" != "true" ]; then + guard=.agents/skills/worktrees-pnpm/scripts/refuse-main-checkout.sh + if [ ! -f "$guard" ]; then + echo "pre-commit: $guard is missing. Run pnpm install (or pnpm dotagents install) first." >&2 + exit 1 + fi + sh "$guard" || exit 1 fi -sh "$guard" || exit 1 pnpm exec lint-staged ``` The `|| exit 1` is load-bearing outside Husky. Husky 9 runs a hook as `sh -e`, so a bare `sh "$guard"` line happens to stop there, but the same two lines as a raw git hook carry on into `lint-staged`, and its passing exit lets the refused commit through. The missing-file check -turns a bare `sh` error into one that says what to run. +turns a bare `sh` error into one that says what to run. It sits inside the `GITHUB_ACTIONS` +test because a repo that installs this skill through dotagents skips that install under CI, so on +a runner the guard may not exist, and the check would otherwise block every automated commit. Without Husky, call it from `.git/hooks/pre-commit`, or from whatever hook manager the repo uses. A person who really means to commit in the primary checkout runs `git commit --no-verify`. diff --git a/.husky/pre-commit b/.husky/pre-commit index 9782c724..d43e07d5 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,7 +1,11 @@ -guard=.agents/skills/worktrees-pnpm/scripts/refuse-main-checkout.sh -if [ ! -f "$guard" ]; then - echo "pre-commit: $guard is missing. Run pnpm install (or pnpm dotagents install) first." >&2 - exit 1 +# GitHub Actions skips the dotagents install (postinstall checks CI), so the +# skill's guard may be absent there; the guard exempts Actions anyway. +if [ "${GITHUB_ACTIONS:-}" != "true" ]; then + guard=.agents/skills/worktrees-pnpm/scripts/refuse-main-checkout.sh + if [ ! -f "$guard" ]; then + echo "pre-commit: $guard is missing. Run pnpm install (or pnpm dotagents install) first." >&2 + exit 1 + fi + sh "$guard" || exit 1 fi -sh "$guard" || exit 1 pnpm exec lint-staged