diff --git a/.codex/hooks.json b/.codex/hooks.json index 5374b0e628..8baaa5a8e2 100644 --- a/.codex/hooks.json +++ b/.codex/hooks.json @@ -5,7 +5,7 @@ "hooks": [ { "type": "command", - "command": "./bin/brew lgtm >&2 && printf '{\"continue\":true}'", + "command": ".codex/hooks/brew-lgtm-stop.sh", "timeout": 360 } ] diff --git a/.codex/hooks/brew-lgtm-stop.sh b/.codex/hooks/brew-lgtm-stop.sh new file mode 100755 index 0000000000..9bc8522484 --- /dev/null +++ b/.codex/hooks/brew-lgtm-stop.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +cd "$(dirname "$0")/../.." || { + printf '%s\n' '{"decision":"block","reason":"Failed to cd to the repository root before running ./bin/brew lgtm."}' + exit 0 +} + +if ./bin/brew lgtm >&2 +then + printf '%s\n' '{"continue":true}' +else + printf '%s\n' '{"decision":"block","reason":"./bin/brew lgtm failed; review the output above and fix it before stopping."}' +fi