cclint provides a GitHub Action for easy integration into your CI/CD pipelines. This allows you to automatically lint CLAUDE.md files on every push and pull request.
Add this workflow to .github/workflows/lint-claude.yml:
name: Lint CLAUDE.md
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
lint-claude:
runs-on: ubuntu-latest
name: Lint CLAUDE.md files
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Lint CLAUDE.md files
uses: felixgeelhaar/cclint@v0.1.2
with:
files: 'CLAUDE.md'
format: 'text'
fail-on-error: 'true'| Input | Description | Required | Default |
|---|---|---|---|
files |
Files to lint (glob pattern or space-separated list) | No | CLAUDE.md |
format |
Output format (text or json) |
No | text |
max-size |
Maximum file size in characters | No | 10000 |
fail-on-error |
Fail the action if errors are found | No | true |
config-file |
Path to configuration file | No | Auto-detected |
| Output | Description |
|---|---|
results |
Linting results in JSON format |
error-count |
Number of errors found |
warning-count |
Number of warnings found |
- name: Lint CLAUDE.md
uses: felixgeelhaar/cclint@v0.1.2
with:
files: 'CLAUDE.md'- name: Lint multiple CLAUDE.md files
uses: felixgeelhaar/cclint@v0.1.2
with:
files: 'CLAUDE.md docs/CLAUDE.md src/CLAUDE.md'
format: 'json'- name: Lint all CLAUDE.md files
uses: felixgeelhaar/cclint@v0.1.2
with:
files: '**/CLAUDE.md'
max-size: '15000'- name: Lint with custom config
uses: felixgeelhaar/cclint@v0.1.2
with:
files: 'CLAUDE.md'
config-file: '.github/cclint-config.json'- name: Lint but continue on errors
uses: felixgeelhaar/cclint@v0.1.2
with:
files: 'CLAUDE.md'
fail-on-error: 'false'
continue-on-error: true- name: Lint CLAUDE.md
id: lint
uses: felixgeelhaar/cclint@v0.1.2
with:
files: 'CLAUDE.md'
format: 'json'
- name: Comment PR with results
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const results = JSON.parse('${{ steps.lint.outputs.results }}');
const errorCount = '${{ steps.lint.outputs.error-count }}';
const warningCount = '${{ steps.lint.outputs.warning-count }}';
let comment = `## 📝 CLAUDE.md Lint Results\n\n`;
comment += `- **Errors:** ${errorCount}\n`;
comment += `- **Warnings:** ${warningCount}\n\n`;
if (results.length > 0) {
comment += `<details>\n<summary>Detailed Results</summary>\n\n`;
comment += '```json\n' + JSON.stringify(results, null, 2) + '\n```\n';
comment += `</details>`;
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});name: Lint CLAUDE.md files
on: [push, pull_request]
jobs:
lint-claude:
runs-on: ubuntu-latest
strategy:
matrix:
file:
- 'CLAUDE.md'
- 'docs/CLAUDE.md'
- 'api/CLAUDE.md'
steps:
- uses: actions/checkout@v4
- name: Lint ${{ matrix.file }}
uses: felixgeelhaar/cclint@v0.1.2
with:
files: ${{ matrix.file }}
format: 'text'name: Comprehensive Check
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Install dependencies
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
# Run tests
- name: Run tests
run: npm test
# Lint code
- name: Lint TypeScript
run: npm run lint
# Lint CLAUDE.md
- name: Lint CLAUDE.md
uses: felixgeelhaar/cclint@v0.1.2
with:
files: 'CLAUDE.md'
format: 'text'
fail-on-error: 'true'
# Build project
- name: Build
run: npm run buildIf you prefer to install cclint manually in your workflow:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install cclint
run: npm install -g cclint
- name: Lint CLAUDE.md
run: cclint lint CLAUDE.md --format json > lint-results.json
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: lint-results
path: lint-results.jsonMake sure you're using the correct version tag:
uses: felixgeelhaar/cclint@v0.1.2 # ✅ Correct
uses: felixgeelhaar/cclint@main # ❌ IncorrectCheck your glob patterns and make sure files exist:
- name: List files before linting
run: find . -name "CLAUDE.md" -type f
- name: Lint CLAUDE.md
uses: felixgeelhaar/cclint@v0.1.2
with:
files: 'CLAUDE.md'Make sure the action has proper permissions:
permissions:
contents: read
pull-requests: write # If commenting on PRs- Pin to specific version: Use
@v0.1.2instead of@main - Use meaningful job names: Help identify failures quickly
- Cache when possible: Cache Node.js dependencies for faster runs
- Fail fast: Use
fail-on-error: trueto catch issues early - Provide feedback: Use outputs to comment on PRs with results