Skip to content

Validate in CI ​

You add one workflow file to your content repository: every push and every pull request runs alta lint, the build fails on the first problem, and the full report is kept as JSON for your tools. It is the same check as on your machine, so what passes there passes here.

Before you begin 10 minutes

  • A repository with content that passes alta lint, for example the pack of the quickstart.
  • GitHub Actions on that repository. Any other CI works the same way: it runs the same commands.
  1. Check the repository as the CI will

    Run the check from the root of your repository. . checks every content file below it: each .json with a "schema", and each universe folder. --strict makes a warning fail too, so nothing slips into the main branch half done.

    Terminal
    sh
    alta lint . --strict
    Output
    text
    ok   my-pack/quests.json (quests)
    1 checked, 0 errors, 0 warnings
  2. Read the JSON report

    --json prints the report in the alta.check/1 format: ok, then each file with its problems and warnings. A problem gives the field, the rule (its section on the errors page), the message, and where it is in context. The exit code says the verdict: 0 ok, 1 problems found, 2 bad usage.

    Terminal
    sh
    alta lint . --json
    Output (shape)
    text
    {
      "schema": "alta.check/1",
      "ok": false,
      "files": [
        {
          "path": "my-pack/quests.json",
          "kind": "quests",
          "ok": false,
          "problems": [
            {
              "level": "error",
              "field": "quests[0].steps[0].kind",
              "rule": "step.kind",
              "message": "…",
              "docs": "https://docs.os.altasystem.ai/reference/errors#step-kind",
              "context": { "where": "quest core.my-pack.welcome, step read" }
            }
          ],
          "warnings": []
        }
      ],
      "skipped": []
    }
  3. Add the workflow

    Save this file as .github/workflows/alta-check.yml. It installs the alta command as on your machine, runs the strict check (the step that fails the build), then keeps the JSON report as a build artifact, even when the check failed.

    .github/workflows/alta-check.yml
    yaml
    # A GitHub Actions workflow for a content repository: every push and pull request runs `alta lint`.
    # Save it as .github/workflows/alta-check.yml in your repository.
    name: alta lint
    
    on: [push, pull_request]
    
    jobs:
      check:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
    
          - uses: actions/setup-node@v4
            with:
              node-version: 22
    
          - name: Install the alta command
            working-directory: ${{ runner.temp }}
            run: |
              git clone --depth 1 https://github.com/alta-system-os/alta-os.git
              cd alta-os
              npm install
              npm install --global ./tools/cli
    
          - name: Check the content
            run: alta lint . --strict
    
          - name: Keep the report as JSON
            if: always()
            run: alta lint . --json > "${{ runner.temp }}/alta-check.json" || true
    
          - uses: actions/upload-artifact@v4
            if: always()
            with:
              name: alta-check
              path: ${{ runner.temp }}/alta-check.json

    examples/ci/alta-check.yml

  4. Push, and read the result

    Push the workflow. On every push and pull request, the job runs; a red job prints each problem with its file, its field, how to fix it and the link to its rule. The alta-check artifact holds the JSON report.

    Terminal
    sh
    git add .github/workflows/alta-check.yml
    git commit -m "Check the content on every push"
    git push

Pitfalls ​

DoAvoid
Write the JSON report outside the folder you checkalta lint . --json > report.json: the next check reads report.json as content
--strict in CI, so a warning blocks the mergeLetting warnings pile up until they matter
One alta lint . at the rootA list of files to keep up to date by hand
The same Node version as on your machine (20 or later)An older Node: the command needs 20

Known limits, said plainly: alta is not on npm yet, so the workflow installs it from the repository, as on your machine. Files without a "schema" are skipped and listed under skipped: that is how a package.json stays out of the check.

Go further ​

What's next

Alta OS is open source (MIT).