CI and automation
PushWarden is one program with fixed exit codes and JSON output, so it fits in pipelines and scripts.
The CI gate (scan --ci) and the pre-commit hook are part of PushWarden Pro. Each device that runs them uses one place on your key, so they fit best on your own machines and self-hosted runners. Runners that start from nothing on every run would use a new place each time; talk to us about a Custom plan ([email protected]) for that.
Exit codes
| Code | Meaning |
|---|---|
0 |
clean or done |
1 |
threats found, or not fully fixed |
2 |
usage error or failure |
Scan in GitHub Actions
Add this file to a repository. It fails the job when it finds malware.
# .github/workflows/malware-scan.yml
name: Malware Scan
on: [push, pull_request]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: curl -fsSL https://pushwarden.com/install.sh | PUSHWARDEN_NO_INSTALL=1 sh
- run: ~/.local/bin/pushwarden scan --ci --no-system --no-report --no-prompt .
The same two commands work in any other pipeline.
| Flag | Why |
|---|---|
--ci |
no colour, never asks (Pro) |
--no-system |
skip host checks (the runner is not your machine) |
--no-prompt |
never changes a file |
--json FILE |
keep a machine-readable result |
To pin a version, put PUSHWARDEN_VERSION=v0.5.3 before sh.
Stop bad commits
pushwarden harden --pre-commit .
The hook checks the staged files and blocks the commit if one carries malware. With a hook manager, call pushwarden check-staged || exit 1.
Clean GitHub from a pipeline
GITHUB_TOKEN=... pushwarden github-clean --ci --apply --json clean.json
Alerts to Slack, Discord or Teams
pushwarden config --set webhook_url=https://hooks.slack.com/services/T000/B000/XXXX
See Team reporting.
Audit without touching anything
pushwarden scan --home --no-prompt --verbose --json audit.json
Useful variables
| Variable | What it does |
|---|---|
PUSHWARDEN_HOME |
use another data folder (a temporary one in CI) |
PUSHWARDEN_NO_BLOCK=1 |
never ask for administrator rights |
PUSHWARDEN_NO_INSTALL=1 |
the install script only downloads the program |
NO_COLOR=1 |
no colours |
GITHUB_TOKEN, GH_TOKEN |
token for github-clean |
Remember
- Exit code
1is what fails your job. - The latest scan report is always at
reports/latest.jsonin the data folder. pushwarden history --jsonandpushwarden alerts --jsongive raw records.