CI
Run Preflight in CI and a pull request can’t merge a launch mistake. --ci turns off prompts, and the exit code fails the step: 2 on an error, 1 on warnings only.
GitHub Actions
With the install script:
- name: Run Preflight
run: |
curl -fsSL https://preflight.sh/install.sh | sh
preflight scan --ciWith npm:
- name: Run Preflight
run: |
npm install -g @preflightsh/preflight
preflight scan --ciWith Docker, mounting the checkout at /app:
- name: Run Preflight
run: docker run -v ${{ github.workspace }}:/app ghcr.io/preflightsh/preflight scan --ci --format jsonThe image holds the CLI and nothing else: no package managers and no git. The vulnerability check reports a missing audit tool as inconclusive, and so does the secrets check on a git checkout, because it cannot ask git which files are tracked. Use the install script or npm when you want those two checks to give an answer.
Failing on errors only
A warning exits 1, which fails a step. To fail only on errors, let 1 through:
- name: Run Preflight
run: |
preflight scan --ci || [ $? -eq 1 ]Keeping a history
Add --publish and each CI run lands on your dashboard, so you can see what changed between deploys. Publishing never fails a build: offline or signed out, the scan still runs and exits as it would have.
To sign the runner in, save a CLI token as a repository secret and pass it to preflight auth login in PREFLIGHT_TOKEN before the scan. A token comes from preflight auth login on your own machine, which stores it in ~/.preflight/credentials.json; revoking it in the dashboard’s settings signs out every place that uses it.
- name: Run Preflight
env:
PREFLIGHT_TOKEN: ${{ secrets.PREFLIGHT_TOKEN }}
run: |
preflight auth login
preflight scan --ci --publishPull requests from forks
The vulnerability check runs the project’s package manager, and project configuration can make a package manager run code. When CI scans a fork’s pull request, add --skip vulnerability. Checks explains why.