Skip to content
You are reading v0.60.0. Read the latest stable guide

GitHub Action ​

Spec42 ships a composite GitHub Action for validating SysML v2 and KerML models in CI. The Action downloads the matching release binary for the runner platform, optionally runs spec42 doctor, and then runs spec42 check.

Basic Usage ​

yaml
name: Spec42

on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read
  security-events: write

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

      - uses: elan8/spec42@vX.Y.Z
        with:
          path: examples/timer/KitchenTimer.sysml
          format: sarif
          warnings-as-errors: true

When format is sarif, the Action writes spec42.sarif, uploads it to GitHub Code Scanning by default, and still fails the job if spec42 check reports validation errors.

Inputs ​

InputDefaultDescription
versionAction ref (github.action_ref, e.g. vX.Y.Z)Spec42 release tag to install. Omit to use the @vX.Y.Z ref from uses:.
pathrequiredFile or workspace path to validate.
workspace-rootOptional workspace root passed to spec42 check.
formatsarifOutput format: text, json, sarif, or junit.
warnings-as-errorsfalseTreat warnings as errors.
baselineOptional baseline file passed to spec42 check.
configOptional config file passed as --config.
library-pathOptional additional library root passed as --library-path.
stdlib-pathOptional standard library root passed as --stdlib-path.
no-stdlibfalseDisable bundled standard library resolution.
run-doctortrueRun spec42 doctor before validation.
upload-sariftrueUpload SARIF to GitHub Code Scanning when format is sarif.
sarif-filespec42.sarifSARIF output file path.

Installing Only ​

The Action exposes the installed binary path as executable-path, so workflows can run additional CLI commands after validation.

yaml
- id: spec42
  uses: elan8/spec42@vX.Y.Z
  with:
    path: examples/office
    format: text
    upload-sarif: false

- run: "${{ steps.spec42.outputs.executable-path }} generate --help"

Requirements and pitfalls ​

  • Pin a version tag — Use elan8/spec42@vX.Y.Z, not @main. The install step downloads spec42-X.Y.Z-<platform> from GitHub Releases; branch refs have no matching archive.
  • Action ref vs CLI — uses: elan8/spec42@vX.Y.Z selects the Action code at that tag; the CLI is downloaded for the same ref unless you override version. Keep them aligned.
  • Checkout first — The Action does not check out your repository; add actions/checkout before Spec42.
  • Permissions — SARIF upload needs security-events: write. On pull requests from forks, upload often fails even when validation passes; the Action uploads with continue-on-error so the job still fails only on spec42 check results.
  • warnings-as-errors — When true, any warning fails the job. Large example repos may need false or a narrower path while tuning models.
  • Explicit version workaround — If an older Action tag cannot resolve its ref, set version: vX.Y.Z in with:.

Publishing Notes ​

The Action is available when this repository has a GitHub release/tag that contains the platform archives produced by .github/workflows/release.yml. Use a version tag that includes this Action, such as the next Spec42 release tag, in downstream workflows so the Action code and downloaded CLI release stay aligned.

Spec42 validates action.yml in CI via .github/workflows/action-smoke.yml (actionlint + a real spec42 check against a published release).

Spec42 is the SysML v2 language server and tooling behind Elan8 model-based engineering.