4 Checks for AI Agent Coding: gitleaks, zizmor, actionlint, ShellCheck

 ・ 9 min

photo by John Lee(https://unsplash.com/@john_artifexfilm?utm_source=templater_proxy&utm_medium=referral) on Unsplash

Once you hand coding to AI agents, they write the commits, the GitHub Actions workflows, and the shell scripts too. This post covers the four checks I run on AI agent coding (gitleaks, zizmor, actionlint, ShellCheck): what each one catches, how I set it up, and what went wrong along the way.

I work in a setup where several agents open PRs at the same time. Since I hand agents goals and let them run, things are different from when a person read every line before pushing. I needed checks that apply the same bar every time instead of a pair of eyes.

Why agent coding needs automated checks#

The four tools catch different things. They barely overlap, so none of them can stand in for the others.

Tool What it catches Where I run it
gitleaks Secrets in commits, such as keys and tokens Pre-push hook, PRs, daily
zizmor Security problems in GitHub Actions workflows PRs in the workflow repository
actionlint Workflow syntax and expression errors PRs in the workflow repository
ShellCheck Shell script mistakes like quoting and unused variables Only scripts changed in a PR

All four are command-line tools that run on your own machine. They need no login and no API key, and they have no call limit. The gitleaks section shows why that matters.

Homebrew installs all of them at once. This post uses gitleaks 8.30.1, zizmor 1.32.0, actionlint 1.7.12, and ShellCheck 0.11.0.

brew install gitleaks zizmor actionlint shellcheck

gitleaks: secret scanning before push and in CI#

gitleaks walks git commits and looks for strings that look like API keys or tokens. I run it in two places: a pre-push hook and CI.

Block the push with a pre-push hook#

A global pre-push hook scans only the commits in this push. The core is one line.

# Scan only commits that are not on origin/main, and redact the values
gitleaks git --log-opts="origin/main..HEAD" --redact --verbose --exit-code 42 .
  • --redact hides the value it found. A secret should not be printed again into the terminal log.
  • --exit-code 42 sets a separate exit code for "found a secret". The default is 1, and gitleaks also exits with 1 when it crashes, so you cannot tell the two apart.

The hook blocks the push only when it finds a secret. If gitleaks is not installed or crashes, the hook prints a warning and lets the push through. I decided that was better than a tool problem stopping every push.

You do have to know the limits.

  • git push --no-verify skips the hook.
  • A repository with its own core.hooksPath (husky, for example) never runs the global hook.
  • A push that passed because the tool crashed is a push nobody scanned.

So the hook is a safety net for accidents. It does not guarantee anything, so CI scans one more time.

Why I switched from ggshield to gitleaks#

At first the hook called GitGuardian's ggshield and used gitleaks only when ggshield could not answer. The GitGuardian free quota is 10,000 calls per 30 days. Once that quota was used up, every push only printed this.

no more API calls available

gitleaks was doing the scan every time anyway. So I took the ggshield call out of the hook and kept gitleaks alone. gitleaks runs locally, with no login and no call quota.

In CI, scan PR commits and the full history separately#

CI has two scan scopes.

  1. PRs: scan the commits in the PR (base..HEAD). The scan works per commit, so it also catches a secret that was added and then removed inside the PR.
  2. Once a day: scan the full history of the default branch and tags.

Unlike the hook, CI fails closed. A finding, a different gitleaks version, a crash, or a missing report all fail the job. "Could not scan" must never read as "clean".

False positives get an exception only through a one-line fingerprint. I never exclude a whole path or rule.

# Format: <commit>:<file>:<rule>:<line>
echo '<commit>:<file>:<rule>:<line>' >> .gitleaksignore

This one caught me once. A squash merge keeps the line and changes the commit SHA. The fingerprint registered in the PR did not match the commit on the default branch, so I had to register the same false positive twice.

When a real secret is found#

The agents follow three rules.

  • Never paste the value into a PR, an issue, or a log. Report the key name only.
  • Deleting it from the file is not the end. A key that stays in history is still live.
  • A person rotates the key and rewrites history. An agent does not.

zizmor: security checks for GitHub Actions workflows#

zizmor is a static analysis tool that reads GitHub Actions workflow files and finds security problems.

Running it on this blog's repository gives this. The most frequent finding is an action referenced by tag.

zizmor --offline .github/workflows
error[unpinned-uses]: unpinned action reference
  --> .github/workflows/ci.yml:19:15
   |
19 |         uses: pnpm/action-setup@v6
   |               ^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
 
...
 
28 findings (9 suppressed, 1 safe fixes, 2 unsafe fixes): 0 informational, 2 low, 0 medium, 17 high

That is 17 high findings across three workflows. Besides unpinned-uses, it points out risky triggers such as pull_request_target (dangerous-triggers) and credentials that checkout leaves behind (artipacked). With --offline, it reads local files only and needs no network or token.

Why pin third-party actions to a commit SHA#

A tag like @v6 can be moved to a different commit later. In my case the CI runner is also my development machine, so a compromised action could reach the credentials on that machine. That is why I recently added zizmor to the checks in my workflow repository, with this policy.

# .github/zizmor.yml
rules:
  unpinned-uses:
    config:
      policies:
        '*': hash-pin # Pin third-party actions to a 40-character commit SHA
        actions/*: ref-pin # Allow tags for GitHub-owned actions (Dependabot updates them)

A pinned action looks like this. The trailing comment records which version it is.

- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0

Keep existing findings as a baseline and block new files first#

The first run produces a flood of findings. If you wait until all of them are fixed, you never turn the check on. So CI fails only on medium and above, and the findings that already existed are listed in a per-file ignore.

zizmor --offline --no-progress --min-severity medium --config .github/zizmor.yml .github

When a file in ignore gets fixed, its line is removed. A new file is checked with no exceptions.

actionlint: catch workflow syntax and expression errors#

actionlint catches errors in workflow YAML syntax, expressions, and runner labels. zizmor asks "is this dangerous?", and actionlint asks "does this even run?".

Run it with no arguments and it finds the nearest .github/workflows and checks everything in it. If ShellCheck is installed, it also checks the shell scripts inside run:. This blog's repository produced this.

.github/workflows/next.yml:47:9: shellcheck reported issue in this script: SC2086:info:1:41: Double quote to prevent globbing and word splitting [shellcheck]
   |
47 |         run: echo "store-path=$(pnpm store path)" >> $GITHUB_OUTPUT

It says $GITHUB_OUTPUT is missing quotes.

Two things were worth knowing during setup.

  • Self-hosted runner labels: actionlint does not know labels you added yourself and reports them as errors. Declare them in .github/actionlint.yaml.
  • ShellCheck style findings: if existing workflows have many findings like SC2086, everything fails the moment you turn the check on. In CI I turn the ShellCheck integration off with actionlint -shellcheck= and block workflow errors only.
# .github/actionlint.yaml
self-hosted-runner:
  labels:
    - my-runner

A passing actionlint run does not mean the workflow behaves correctly. Some errors have valid syntax and show up only at run time, and neither actionlint nor ShellCheck catches those. I keep separate tests for them.

ShellCheck: strict checks on changed shell scripts only#

ShellCheck finds shell script mistakes such as missing quotes and unused variables. Agents write a lot of automation scripts, so it pays off.

Here I chose the opposite strategy from actionlint. Instead of a loose check over everything, it looks only at files changed in the PR and fails on any warning. There is no allowlist and no baseline. If you touch a file that has a warning, you fix that warning to pass.

# Run it once per file
shellcheck --norc --format=json -- scripts/deploy.sh

Here is what I learned while wiring it up.

  • Pass one file at a time. With several scripts in one call, source and unused-variable diagnostics can go missing depending on the other inputs.
  • Check files without an extension too. The targets are .sh, .bash, and any file with a shell shebang.
  • Exclude zsh explicitly. ShellCheck does not support zsh, so I keep an exclusion list with each path and reason.
  • Build the target list with git ls-files. Default search tools hide files matched by ignore rules, so a tracked file can drop out of the list.

Three failures while adding these checks#

The most dangerous cases were checks that looked like they passed and had never run.

A secret* gitignore pattern dropped the scanner file#

I put "secret" in the scanner script's name. A secret* pattern in the global gitignore matched it, and git add silently left it out. The workflow ended up calling a file that did not exist.

Now I name the file after the tool, like gitleaks_scan.py, and run git ls-files right after the commit to confirm the new file is in.

Checking out the PR head gave "Start directory is not importable"#

The security workflow checked out the PR's head commit. A branch that forked before the scanner was added did not have the scanner directory at all. The test step died with this error, and the ShellCheck and gitleaks steps never ran.

Start directory is not importable

The fix was to leave ref unset on checkout. A pull_request event checks out the merge commit with the base by default. That commit contains the scanner from the base together with the PR's changes.

The fake test key was not detected#

For the regression test that confirms gitleaks catches secrets, I used an example key from official documentation. Example keys like that are exceptions in the gitleaks default rules, so it was not detected. The test had verified nothing from the start.

Now I build a synthetic key that matches the character set the rule requires, and I confirm it is detected (the test fails) first before using it.

Principles I apply to all four tools#

  1. Pin the version. If the runner is missing the pinned version or has a different one, the check fails. It does not skip.
  2. Open locally, closed in CI. The pre-push hook lets a push through when the tool crashes. CI fails when the tool crashes.
  3. Decide how to handle existing findings first. Pick from changed files only (ShellCheck), a severity threshold with a per-file baseline (zizmor), or exact fingerprints (gitleaks).
  4. Keep secrets out of the output. Redact the value and keep only the rule name, file, line, and commit.
  5. Do not depend on an external API quota. Once the quota is used up, you get a warning message instead of a scan.

Splitting work into issues with completion criteria for agents matters, and so does a filter that holds their output to the same bar every time. If adding all four at once feels like too much, start with the gitleaks pre-push hook. Install gitleaks and have your global pre-push hook call the command above.


You can do it if you believe you can!

— Napoleon Hill


Other posts
AI Agent Workflow: Break an Idea into Issues with Completion Criteria 커버 이미지
 ・ 6 min

AI Agent Workflow: Break an Idea into Issues with Completion Criteria

4 Real AI Agent Automation Examples: Hand Off Goals, Not Chats 커버 이미지
 ・ 8 min

4 Real AI Agent Automation Examples: Hand Off Goals, Not Chats

6 Frontend Dev Environment Fundamentals, Revisited for 2026 커버 이미지
 ・ 11 min

6 Frontend Dev Environment Fundamentals, Revisited for 2026