GitHub Actions Integration - Archyl Docs

Run architecture conformance checks, drift scoring, context generation, and more in your CI/CD pipeline with Archyl's official GitHub Actions

GitHub Actions Integration

Archyl provides six official GitHub Actions that integrate architecture governance directly into your CI/CD pipeline.

Action Trigger Purpose
Conformance Check Pull requests Validate code changes against architecture rules
Drift Score Pull requests Compute drift score and enforce quality gate
Generate Context Push to main Generate archyl.txt for AI agents
Auto CR Push to main Create Architecture Change Requests on merge
Release Push / tags Track releases in Archyl
Sync Push to main Sync archyl.yaml DSL to Archyl

All actions are published at archyl-com/actions and versioned with @v1.

Prerequisites

Before using the actions, you need:

  1. An Archyl API key -- Go to Profile > API Keys and create one with write scope
  2. An Organization ID -- Found in your organization settings page
  3. A Project ID -- Found in your project's URL or settings page
  4. Store these as GitHub secrets and variables:
Settings > Secrets > Actions:
  ARCHYL_API_KEY       # Your API key (secret)

Settings > Variables > Actions:
  ARCHYL_ORG_ID        # Organization UUID
  ARCHYL_PROJECT_ID    # Project UUID

Quick Start

The fastest way to get started is with Archyl's reusable workflows -- one for PRs, one for main branch pushes:

# .github/workflows/archyl.yml
name: Archyl Architecture

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  # Conformance check + drift score on PRs (run in parallel)
  pr-checks:
    if: github.event_name == 'pull_request'
    uses: archyl-com/actions/.github/workflows/archyl-pr.yml@v1
    with:
      organization-id: ${{ vars.ARCHYL_ORG_ID }}
      project-id: ${{ vars.ARCHYL_PROJECT_ID }}
      drift-threshold: 70
    secrets:
      api-key: ${{ secrets.ARCHYL_API_KEY }}

  # Generate context + sync + release on merge to main
  main-sync:
    if: github.event_name == 'push'
    uses: archyl-com/actions/.github/workflows/archyl-main.yml@v1
    with:
      organization-id: ${{ vars.ARCHYL_ORG_ID }}
      project-id: ${{ vars.ARCHYL_PROJECT_ID }}
      sync: true
      release: true
      release-environment: 'production'
    secrets:
      api-key: ${{ secrets.ARCHYL_API_KEY }}

This gives you a complete architecture governance loop: conformance rules validate every PR, drift score tracks how well your code matches the model, and on merge the model stays in sync automatically.

Individual Actions

Conformance Check

Runs your conformance rules against files changed in a pull request. Annotates violations inline and posts a PR comment summary.

- uses: archyl-com/actions/conformance-check@v1
  with:
    api-key: ${{ secrets.ARCHYL_API_KEY }}
    organization-id: ${{ vars.ARCHYL_ORG_ID }}
    project-id: ${{ vars.ARCHYL_PROJECT_ID }}

Inputs

Input Required Default Description
api-key Yes -- Archyl API key with write scope
organization-id Yes -- Archyl organization UUID
project-id Yes -- Archyl project UUID
api-url No https://api.archyl.com Custom API URL (for self-hosted)
fail-on No error Minimum severity that fails the check: error, warning, or none
comment-on-pr No true Post a summary comment on the pull request
github-token No ${{ github.token }} GitHub token for PR comments
max-file-lines No 200 Maximum lines to send per file (reduces token usage)
chunk-size No 20 Number of files to send per API call (for large diffs)

Outputs

Output Description
check-id UUID of the conformance check
total-violations Total number of violations found
errors Number of error-level violations
warnings Number of warning-level violations
infos Number of info-level violations
status Check result: pass or fail

Using Outputs

- uses: archyl-com/actions/conformance-check@v1
  id: conformance
  with:
    api-key: ${{ secrets.ARCHYL_API_KEY }}
    organization-id: ${{ vars.ARCHYL_ORG_ID }}
    project-id: ${{ vars.ARCHYL_PROJECT_ID }}
    fail-on: none  # Don't fail, handle manually

- name: Custom handling
  if: steps.conformance.outputs.status == 'fail'
  run: |
    echo "Found ${{ steps.conformance.outputs.total-violations }} violations"
    echo "Errors: ${{ steps.conformance.outputs.errors }}"
    echo "Warnings: ${{ steps.conformance.outputs.warnings }}"

Drift Score

Computes the architecture drift score -- how well your codebase matches your C4 model. Optionally enforces a quality gate by failing the build if the score drops below a threshold.

- uses: archyl-com/actions/drift-score@v1
  with:
    api-key: ${{ secrets.ARCHYL_API_KEY }}
    organization-id: ${{ vars.ARCHYL_ORG_ID }}
    project-id: ${{ vars.ARCHYL_PROJECT_ID }}
    threshold: 70

Inputs

Input Required Default Description
api-key Yes -- Archyl API key with write scope
organization-id Yes -- Archyl organization UUID
project-id Yes -- Archyl project UUID
api-url No https://api.archyl.com Custom API URL (for self-hosted)
threshold No 0 Minimum acceptable drift score (0-100). Fails if score is below this. Set to 0 to never fail.
poll-interval No 5 Seconds between status polls while waiting for computation
poll-timeout No 300 Maximum seconds to wait for computation to complete
comment-on-pr No false Post a summary comment on the pull request
github-token No ${{ github.token }} GitHub token for PR comments

Outputs

Output Description
score Drift score (0-100)
score-id UUID of the drift score record
total-elements Total number of elements compared
matched-count Number of matched elements
missing-in-code Number of elements missing in code
new-in-code Number of new elements found in code
status Computation status: completed or failed

Generate Context

Generates an archyl.txt file containing your architecture context, optimized for AI agents and LLMs. Can auto-commit the file when it changes.

- uses: archyl-com/actions/generate-context@v1
  with:
    api-key: ${{ secrets.ARCHYL_API_KEY }}
    organization-id: ${{ vars.ARCHYL_ORG_ID }}
    project-id: ${{ vars.ARCHYL_PROJECT_ID }}
    commit: 'true'

Inputs

Input Required Default Description
api-key Yes -- Archyl API key with read scope
organization-id Yes -- Archyl organization UUID
project-id Yes -- Archyl project UUID
api-url No https://api.archyl.com Custom API URL (for self-hosted)
output-file No archyl.txt Path to write the generated context file
format No markdown Output format: markdown for LLM-optimized briefing, full for structured JSON + markdown
commit No false Auto-commit the generated file if it changed
commit-message No chore: update archyl.txt architecture context Commit message when auto-committing

Outputs

Output Description
file-path Path to the generated context file
changed Whether the file content changed (true or false)
token-count Approximate token count of the generated file

Auto CR

Automatically creates an Architecture Change Request in Archyl when code is merged to main. Analyzes the diff to detect architecture-relevant changes and tracks them for review.

- uses: archyl-com/actions/auto-cr@v1
  with:
    api-key: ${{ secrets.ARCHYL_API_KEY }}
    organization-id: ${{ vars.ARCHYL_ORG_ID }}
    project-id: ${{ vars.ARCHYL_PROJECT_ID }}

Inputs

Input Required Default Description
api-key Yes -- Archyl API key with write scope
organization-id Yes -- Archyl organization UUID
project-id Yes -- Archyl project UUID
api-url No https://api.archyl.com Custom API URL (for self-hosted)
github-token No ${{ github.token }} GitHub token for commit comments and diff access
base-ref No (auto-detected) Base ref to compare against
comment-on-commit No false Post a comment on the merge commit with the Change Request link

Outputs

Output Description
request-id UUID of the created Change Request
changes-detected Number of architecture-relevant changes found
status created, skipped (no changes), or failed

Release

Creates or updates a release in Archyl from your CI pipeline. Track deployments, associate them with environments and C4 elements, and feed your DORA metrics.

- uses: archyl-com/actions/release@v1
  with:
    api-key: ${{ secrets.ARCHYL_API_KEY }}
    project-id: ${{ vars.ARCHYL_PROJECT_ID }}
    status: deployed
    environment: production

Inputs

Input Required Default Description
api-key Yes -- Archyl API key with write scope
project-id Yes -- Archyl project UUID
api-url No https://api.archyl.com Custom API URL (for self-hosted)
version No $GITHUB_REF_NAME Release version
status No deployed Release status: planned, in_progress, deployed, rolled_back, failed
changelog No -- Release changelog or description
environment No -- Target environment name (e.g. production, staging). Auto-created if missing.
container-id No -- Archyl container UUID to associate with this release
system-id No -- Archyl system UUID to associate with this release
source-url No -- URL back to the source (commit, release page, etc.)

Outputs

Output Description
release-id UUID of the created or updated release

Sync

Syncs your archyl.yaml DSL file with Archyl. Declare your architecture as code and push changes on every commit.

- uses: archyl-com/actions/sync@v1
  with:
    api-key: ${{ secrets.ARCHYL_API_KEY }}
    project-id: ${{ vars.ARCHYL_PROJECT_ID }}

Inputs

Input Required Default Description
api-key Yes -- Archyl API key with write scope
project-id Yes -- Archyl project UUID
api-url No https://api.archyl.com Custom API URL (for self-hosted)
file No archyl.yaml Path to the archyl.yaml file relative to the repository root

Outputs

Output Description
systems-created Number of systems created
containers-created Number of containers created
components-created Number of components created
relationships-created Number of relationships created
summary Human-readable summary of the sync result

Reusable Workflows

Archyl provides two reusable workflows that combine multiple actions for common scenarios.

archyl-pr.yml

Runs conformance check and drift score in parallel on every pull request.

jobs:
  archyl:
    uses: archyl-com/actions/.github/workflows/archyl-pr.yml@v1
    with:
      organization-id: ${{ vars.ARCHYL_ORG_ID }}
      project-id: ${{ vars.ARCHYL_PROJECT_ID }}
      drift-threshold: 70        # Fail if drift score drops below 70
      fail-on: error              # Fail on error-level conformance violations
      comment-on-pr: true         # Post PR comments with results
    secrets:
      api-key: ${{ secrets.ARCHYL_API_KEY }}

All inputs are optional except organization-id, project-id, and api-key.

archyl-main.yml

Runs generate-context, sync, and release on push to main. Each job is independently toggleable.

jobs:
  archyl:
    uses: archyl-com/actions/.github/workflows/archyl-main.yml@v1
    with:
      organization-id: ${{ vars.ARCHYL_ORG_ID }}
      project-id: ${{ vars.ARCHYL_PROJECT_ID }}
      generate-context: true       # Generate and auto-commit archyl.txt
      context-format: markdown     # LLM-optimized format
      sync: true                   # Sync archyl.yaml to Archyl
      sync-file: archyl.yaml       # Path to your archyl.yaml
      release: true                # Create a release record
      release-status: deployed
      release-environment: production
    secrets:
      api-key: ${{ secrets.ARCHYL_API_KEY }}

Other CI Platforms

GitLab CI

Archyl provides an includable CI template for GitLab. It runs conformance check and drift score on merge requests, and generates context on pushes to the default branch.

Setup:

  1. Add the required CI/CD variables in Settings > CI/CD > Variables:

    • ARCHYL_API_KEY (masked, protected)
    • ARCHYL_ORG_ID
    • ARCHYL_PROJECT_ID
  2. Include the template in your .gitlab-ci.yml:

include:
  - remote: 'https://raw.githubusercontent.com/archyl-com/actions/main/ci-templates/gitlab/.archyl-ci.yml'

This adds three jobs to your pipeline:

  • archyl:conformance -- runs on merge requests
  • archyl:drift-score -- runs on merge requests
  • archyl:generate-context -- runs on pushes to the default branch

Optional variables: ARCHYL_API_URL, ARCHYL_DRIFT_THRESHOLD.

Bitbucket Pipelines

Copy the Archyl pipelines template into your bitbucket-pipelines.yml.

Setup:

  1. Add the required repository variables in Settings > Repository variables:

    • ARCHYL_API_KEY (secured)
    • ARCHYL_ORG_ID
    • ARCHYL_PROJECT_ID
  2. Add the pipeline steps:

pipelines:
  pull-requests:
    '**':
      - step:
          name: "Archyl Conformance Check"
          image: alpine:3.20
          script:
            - apk add --no-cache curl jq git
            - # ... conformance check script
      - step:
          name: "Archyl Drift Score"
          image: alpine:3.20
          script:
            - apk add --no-cache curl jq
            - # ... drift score script

  branches:
    main:
      - step:
          name: "Archyl Generate Context"
          image: alpine:3.20
          script:
            - apk add --no-cache curl jq git
            - # ... generate context script

The full template is available at archyl-com/actions/ci-templates/bitbucket/archyl-pipelines.yml.

Combined Example

A full workflow that uses all six actions together:

# .github/workflows/architecture.yml
name: Archyl Architecture

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  # --- PR checks (parallel) ---

  conformance:
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: archyl-com/actions/conformance-check@v1
        with:
          api-key: ${{ secrets.ARCHYL_API_KEY }}
          organization-id: ${{ vars.ARCHYL_ORG_ID }}
          project-id: ${{ vars.ARCHYL_PROJECT_ID }}

  drift:
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: archyl-com/actions/drift-score@v1
        with:
          api-key: ${{ secrets.ARCHYL_API_KEY }}
          organization-id: ${{ vars.ARCHYL_ORG_ID }}
          project-id: ${{ vars.ARCHYL_PROJECT_ID }}
          threshold: 70
          comment-on-pr: 'true'

  # --- Main branch (after merge) ---

  generate-context:
    if: github.event_name == 'push'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: archyl-com/actions/generate-context@v1
        with:
          api-key: ${{ secrets.ARCHYL_API_KEY }}
          organization-id: ${{ vars.ARCHYL_ORG_ID }}
          project-id: ${{ vars.ARCHYL_PROJECT_ID }}
          commit: 'true'

  sync:
    if: github.event_name == 'push'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: archyl-com/actions/sync@v1
        with:
          api-key: ${{ secrets.ARCHYL_API_KEY }}
          project-id: ${{ vars.ARCHYL_PROJECT_ID }}

  auto-cr:
    if: github.event_name == 'push'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: archyl-com/actions/auto-cr@v1
        with:
          api-key: ${{ secrets.ARCHYL_API_KEY }}
          organization-id: ${{ vars.ARCHYL_ORG_ID }}
          project-id: ${{ vars.ARCHYL_PROJECT_ID }}

  release:
    if: github.event_name == 'push'
    runs-on: ubuntu-latest
    steps:
      - uses: archyl-com/actions/release@v1
        with:
          api-key: ${{ secrets.ARCHYL_API_KEY }}
          project-id: ${{ vars.ARCHYL_PROJECT_ID }}
          status: deployed
          environment: production
          source-url: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}

Viewing Results

Results from all CI-triggered checks appear in Archyl:

  • Conformance checks -- visible in the Conformance Dashboard (Agent Hub > Dashboard tab). Click any check to see violations grouped by file.
  • Drift scores -- visible in the Drift section of your project. Track score history over time.
  • Change Requests -- visible in the Requests section. Review architecture changes before accepting them.
  • Releases -- visible in the Releases section and Environments page. Feeds your DORA metrics.
  • Sync results -- reflected immediately in your C4 model.

See Conformance Rules for more details on the conformance dashboard.

Self-Hosted Archyl

If you're running Archyl on-premise, set the api-url input on any action to point to your instance:

- uses: archyl-com/actions/conformance-check@v1
  with:
    api-key: ${{ secrets.ARCHYL_API_KEY }}
    organization-id: ${{ vars.ARCHYL_ORG_ID }}
    project-id: ${{ vars.ARCHYL_PROJECT_ID }}
    api-url: "https://archyl.internal.company.com"

The default is https://api.archyl.com for all actions.