Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Self-Review
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main

permissions:
contents: read
pull-requests: write

jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: AxeForging/reviewforge@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AI_PROVIDER: gemini
AI_MODEL: gemini-2.5-flash
AI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
SHOW_TOKEN_USAGE: true
INCREMENTAL: false
PERSONA: ""
REVIEW_RULES: concise
69 changes: 69 additions & 0 deletions .github/workflows/structlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: StructLint

on:
workflow_call:
inputs:
config:
description: "Path to .structlint.yaml config file"
type: string
default: ".structlint.yaml"
path:
description: "Directory to validate"
type: string
default: "."
json-output:
description: "Path to write JSON report"
type: string
default: ""
log-level:
description: "Log level: debug, info, warn, error"
type: string
default: "info"
silent:
description: "Silent mode - only exit code"
type: boolean
default: false
version:
description: "Version of structlint to use"
type: string
default: ""
upload-report:
description: "Upload JSON report as artifact"
type: boolean
default: false
comment-on-pr:
description: "Post validation results as a PR comment"
type: boolean
default: false
secrets:
github_token:
description: "GitHub token for PR comments (required if comment-on-pr is true)"
required: false

permissions:
contents: read
pull-requests: write

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: AxeForging/structlint@main
with:
config: ${{ inputs.config }}
path: ${{ inputs.path }}
json-output: ${{ inputs.json-output }}
log-level: ${{ inputs.log-level }}
silent: ${{ inputs.silent }}
version: ${{ inputs.version }}
comment-on-pr: ${{ inputs.comment-on-pr }}
GITHUB_TOKEN: ${{ secrets.github_token || github.token }}

- name: Upload report
if: ${{ inputs.upload-report && inputs.json-output != '' }}
uses: actions/upload-artifact@v4
with:
name: structlint-report
path: ${{ inputs.json-output }}
22 changes: 22 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Validate Structure

on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main

permissions:
contents: read
pull-requests: write

jobs:
structlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
config: .structlint.yaml
comment-on-pr: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .structlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dir_structure:
- "cmd/**" # Command entry points
- "internal/**" # Internal packages
- "test/**" # Test files
- "doc/**" # Documentation
- "docs/**" # Documentation
- "scripts/**" # Build and utility scripts
- "bin/**" # Built binaries
Expand Down Expand Up @@ -41,6 +42,9 @@ file_naming_pattern:
# Documentation
- "*.md"
- "*.txt"
- "*.png"
- "*.jpg"
- "*.svg"
- "README*"
- "LICENSE*"
- "CHANGELOG*"
Expand Down
131 changes: 130 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,141 @@ structlint completion fish > ~/.config/fish/completions/structlint.fish

## CI/CD Integration

### GitHub Action

The simplest way to use structlint in CI — no Go setup required:

```yaml
name: Validate Structure
on: [push, pull_request]

jobs:
structlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: AxeForging/structlint@main
with:
config: .structlint.yaml
```

<details>
<summary><strong>GitHub Actions</strong></summary>
<summary><strong>Action Inputs</strong></summary>

| Input | Description | Default |
|-------|-------------|---------|
| `config` | Path to config file | `.structlint.yaml` |
| `path` | Directory to validate | `.` |
| `json-output` | Path for JSON report | _(none)_ |
| `log-level` | `debug`, `info`, `warn`, `error` | `info` |
| `silent` | Exit code only, no output | `false` |
| `version` | Structlint version to use | _(latest)_ |
| `comment-on-pr` | Post results as a PR comment | `false` |
| `GITHUB_TOKEN` | GitHub token (required for PR comments) | _(none)_ |

</details>

<details>
<summary><strong>Action with JSON Report</strong></summary>

```yaml
- uses: AxeForging/structlint@main
with:
config: .structlint.yaml
json-output: structlint-report.json

- uses: actions/upload-artifact@v4
if: always()
with:
name: structlint-report
path: structlint-report.json
```

</details>

<details>
<summary><strong>Action with PR Comments</strong></summary>

Posts validation results directly on your pull request and writes a GitHub Actions Job Summary:

```yaml
name: Validate Structure
on:
pull_request:
branches: [main]

permissions:
contents: read
pull-requests: write

jobs:
structlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: AxeForging/structlint@main
with:
config: .structlint.yaml
comment-on-pr: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

The comment is updated on each push (not duplicated), and includes a collapsible violation details section.

</details>

### Reusable Workflow

For organizations that want a standardized setup across all repos:

```yaml
# In your repo's .github/workflows/structlint.yml
name: Validate Structure
on: [push, pull_request]

jobs:
structlint:
uses: AxeForging/structlint/.github/workflows/structlint.yml@main
with:
config: .structlint.yaml
```

<details>
<summary><strong>Reusable Workflow Inputs</strong></summary>

| Input | Type | Description | Default |
|-------|------|-------------|---------|
| `config` | `string` | Path to config file | `.structlint.yaml` |
| `path` | `string` | Directory to validate | `.` |
| `json-output` | `string` | Path for JSON report | _(none)_ |
| `log-level` | `string` | `debug`, `info`, `warn`, `error` | `info` |
| `silent` | `boolean` | Exit code only | `false` |
| `version` | `string` | Structlint version | _(latest)_ |
| `upload-report` | `boolean` | Upload JSON report as artifact | `false` |
| `comment-on-pr` | `boolean` | Post results as a PR comment | `false` |

</details>

<details>
<summary><strong>Reusable Workflow with Report Upload</strong></summary>

```yaml
jobs:
structlint:
uses: AxeForging/structlint/.github/workflows/structlint.yml@main
with:
config: .structlint.yaml
json-output: report.json
upload-report: true
```

</details>

<details>
<summary><strong>Manual GitHub Actions (without the action)</strong></summary>

```yaml
name: Validate Structure
on: [push, pull_request]

jobs:
Expand Down
Loading