Search first. Script only when every search tier is empty and the 10-line gate passes. Then put the script in a real file with a real extension.Inlined logic in a YAML
run: step, a Markdown copy-paste block, or a heredoc smuggling a Bash loop
is the worst of every world. It is untestable, unlintable, and undiscoverable. The rules below apply
to every repo across the org.
Iron law
Scripts must live in.sh, .py, .ts, .js, .rb, or .pl files under one of:
scripts/.github/scripts/.claude/hooks/tests/plugins/<name>/hooks/
Banned in non-script files
- YAML
run:with control flow (if,for,while,case) or 4+ lines - Multi-line Bash control flow in a single command
- Heredocs carrying logic (
bash <<EOF,python <<EOF, generated commit bodies) - Inline interpreters:
python -c,node -e,perl -e,ruby -e, multi-linebash -c - Markdown copy-paste-execute blocks with logic
Allowed
- Single-line pipelines (
|,&&,xargs) - 1–3 line YAML
run:without control flow - One-line heredocs feeding static prose
Four-tier search
Before writing any new script, search every tier. Log one line per tier (<tier>: <tool> — found / not-found, reason). Empty rows reject the search.
- Native CLIs / builtins (
jq,gh,git,curl) - Ecosystem primitives (Ansible modules, OpenTofu resources, marketplace Actions, pre-commit)
- Third-party packaged tools (Homebrew, apt, pip, npm, cargo)
- Popular community solutions (GitHub projects, official plugins,
awesome-*lists)
10-line gate
After an empty search:- Fewer than 10 non-comment lines → auto-approved
- 10+ lines → requires explicit sign-off
Worked examples
YAML run: with logic
Wrong:
Multi-line Bash control flow
Wrong:Heredoc smuggling logic
Wrong:git commit -m "$(cat <<'EOF' ... $(if ...) ... EOF)"
Right: git commit -m "feat: standard release" (generate the body in a script file if it needs computation)
Inline interpreters
Wrong:python -c "import json; print(json.load(open('x.json'))['key'])"
Right: jq -r .key x.json
What this connects to
Commit conventions
How commit and PR shapes interact with release-please.
CI/CD policy
Marketplace actions and reusable workflows that replace most ad-hoc scripts.
OpenTofu check placement
The canonical example of the four-tier search applied to a real domain.