# Install Lacan Scan GitHub Action

Use this playbook when adding Lacan Scan to a repository. Coding agents should follow it without asking for the workflow contents.

## Goal

Gate pull requests and pushes to `main` with the composite Action `jose-compu/lacan-scan@v7`, upload SARIF to GitHub code scanning, and keep experimental rules from failing the job.

## Prerequisites

- Repository on GitHub with Actions enabled
- Permission to add `.github/workflows/lacan.yml`
- For SARIF upload: workflow needs `security-events: write`
- Runners: Linux or macOS with `curl` and `python3` (Windows runners are unsupported)

## Steps for an agent

1. Create `.github/workflows/lacan.yml`.
2. Copy the file from [workflows/lacan.yml](./workflows/lacan.yml) verbatim.
3. Commit on a branch named after the change (for example `add-lacan-scan`). Do not put `cursor` in the branch name.
4. Open a pull request if the project requires review. Attribute the commit only to the human maintainer GitHub user; do not add AI co-author trailers.
5. After merge, confirm an Actions run succeeds and that Security → Code scanning shows category `lacan` when SARIF is present.

## Workflow (copy this)

```yaml
name: lacan

on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read
  security-events: write

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: jose-compu/lacan-scan@v7
        with:
          path: .
          fail-on: HIGH
          output: sarif,cli
          sarif-file: lacan.sarif
          version: "7"
          changed-only: ${{ github.event_name == 'pull_request' }}
          changed-base: ${{ github.event.pull_request.base.sha }}
      - uses: github/codeql-action/upload-sarif@v4
        if: always() && hashFiles('lacan.sarif') != ''
        with:
          sarif_file: lacan.sarif
          category: lacan
```

## Action inputs (common)

| Input | Default | Meaning |
| --- | --- | --- |
| `path` | `.` | Directory or file to scan |
| `version` | `7` | Release binary without leading `v`. Use `7` for the current major or `7.6.0` to pin |
| `fail-on` | `HIGH` | Minimum severity that fails the job (`LOW`, `MEDIUM`, `HIGH`, `CRITICAL`) |
| `output` | `sarif` | Comma-separated: `cli`, `json`, `sarif`, `junit` |
| `sarif-file` | `lacan.sarif` | SARIF path when `sarif` is in `output` |
| `changed-only` | `false` | When `true`, scan only files changed vs `changed-base` |
| `changed-base` | empty | Git ref (PR base SHA, branch, or `HEAD~1`) |
| `skip-rules` | empty | Comma-separated rule ids, merged with `.lacan.toml` |
| `config` | empty | Path to `.lacan.toml` (auto-detected under `path` if omitted) |

Action ref: `jose-compu/lacan-scan@v7`  
Marketplace: https://github.com/marketplace/actions/lacan-scan  
Source: https://github.com/jose-compu/lacan-scan/blob/main/action.yml

## Suppressions

- Inline: `# lacan:skip=AIS008:reason` (also `//` and `/* */`)
- Repo config: `.lacan.toml` with `skip-rules` and `[ignore]` path specs

## What not to do

- Do not use a different Action name or invent `jose-compu/lacan`
- Do not pin `@v6` unless the user asks for the previous rule line
- Do not treat SARIF as an Actions artifact; it is uploaded to code scanning
- Do not mark experimental rules as job failures; they report and never fail `--fail-on`

## CLI alternative

```bash
cargo install lacan-scan --locked
lacan scan . --fail-on HIGH
```

Site: https://jose-compu.github.io/lacan-scan/  
Agent index: https://jose-compu.github.io/lacan-scan/llms.txt
