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
17 changes: 17 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ jobs:
with:
since: origin/${{ github.base_ref }}

setup-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- id: setup
uses: ./setup
with:
version: v0.6.0
- name: Verify setup outputs and executable
env:
BINARY: ${{ steps.setup.outputs.binary }}
VERSION: ${{ steps.setup.outputs.version }}
run: |
test -x "$BINARY"
test -n "$VERSION"
test "$(command -v structlint)" = "$BINARY"

lint:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions .structlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dir_structure:
- ".github/**" # GitHub configuration
- "schema/**" # JSON Schema for editor autocomplete
- "skills/**" # Shipped agent skill (SKILL.md)
- "setup/**" # Install-only GitHub Action
disallowedPaths:
- "vendor/**" # Vendor dependencies
- "node_modules/**" # Node.js dependencies
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,17 @@ structlint completion fish > ~/.config/fish/completions/structlint.fish

### GitHub Action

Install without running Structlint (for Gauntlet or custom pipelines):

```yaml
- uses: AxeForging/structlint/setup@v0.6.0
with:
version: v0.6.0
```

Pin both references for reproducible CI; use `version: latest` only when
intentionally opting into floating releases.

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

```yaml
Expand Down
31 changes: 31 additions & 0 deletions docs/specs/013-setup-action.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Setup action

## Problem

The root action installs and runs Structlint, so workflows that orchestrate it
through Gauntlet must duplicate installer shell code.

## Approach

Add an install-only `setup/action.yml` composite action. It accepts `version`
(default `v0.6.0`) and `install-dir` (default runner temp), invokes the existing
checksum-verifying installer, adds the directory to `PATH`, and verifies the
binary. Keep the root action backward-compatible.

## Requirements

- Never compile Structlint or silently fall back to `go install`.
- Preserve checksum verification from `install.sh`.
- Permit an explicit pinned tag or `latest`.
- Expose the installed version and binary path as outputs.
- Document pinned usage through Gauntlet.

## Test plan

- Existing executable installer regression test remains authoritative.
- Exercise the composite action in the repository PR workflow.
- Run the real Structlint and Dupehound gates through Gauntlet.

## Rollout

Pilot in Structlint, then apply the same contract to Dupehound and Gauntlet.
7 changes: 7 additions & 0 deletions docs/specs/013-setup-action.plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Setup action plan

- [x] Add install-only composite action and outputs.
- [x] Add action contract validation to PR CI.
- [x] Document direct and Gauntlet usage.
- [ ] Validate and merge the pilot PR.
- [ ] Roll the contract into Dupehound and Gauntlet.
39 changes: 39 additions & 0 deletions setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Setup Structlint
description: Install a checksum-verified Structlint release and add it to PATH.
author: AxeForging
inputs:
version:
description: Structlint release tag, or latest for a floating install.
required: false
default: v0.6.0
install-dir:
description: Installation directory. Empty uses RUNNER_TEMP/structlint-bin.
required: false
default: ""
outputs:
binary:
description: Absolute path to the installed binary.
value: ${{ steps.install.outputs.binary }}
version:
description: Version reported by the installed binary.
value: ${{ steps.install.outputs.version }}
runs:
using: composite
steps:
- id: install
shell: bash
env:
REQUESTED_VERSION: ${{ inputs.version }}
REQUESTED_DIR: ${{ inputs.install-dir }}
run: |
set -euo pipefail
install_dir="${REQUESTED_DIR:-${RUNNER_TEMP}/structlint-bin}"
STRUCTLINT_VERSION="$REQUESTED_VERSION" STRUCTLINT_INSTALL_DIR="$install_dir" "$GITHUB_ACTION_PATH/../install.sh"
binary="$install_dir/structlint"
test -x "$binary"
echo "$install_dir" >> "$GITHUB_PATH"
echo "binary=$binary" >> "$GITHUB_OUTPUT"
echo "version=$($binary --version | head -1)" >> "$GITHUB_OUTPUT"
branding:
icon: check-square
color: blue
Loading