Synced from Hive. This page is pulled from hivecommons/hive@v5 during the docs build. Edit the canonical source in the Hive repository.

Importing GitHub Actions workflows

Hive can read a repository’s GitHub Actions workflows and propose a lifecycle workflow model that already knows the repository’s CI. Each workflow file becomes a pipeline (a DAG of jobs) inside the model. Hive renders the pipelines and binds them to the right lifecycle states; GitHub Actions keeps running the jobs. Hive does not trigger, re-run, cancel or gate them.

For how this fits with the other kinds of workflow, see Workflows in hive.

Prerequisites

  • Owner role on the hive. Every ingest route and the Ingest view are owner-only, and each saved ingest is audited as workflow_ingest.
  • Read access to the repository for the hive’s GitHub credential, when you ingest by repository name. Hive downloads the default branch read-only, keeps only the files ingest reads and deletes the checkout. You can also paste workflow files instead (API only), which needs no repository access.
  • Optional: administration:read on the repository. With it, ingest also reads the default branch’s protection (required checks, required approvals, code-owner review). Without it, hive falls back to the repository and organisation rulesets, which omit some legacy protection settings. A failure to read branch rules is logged and does not stop the ingest.

Import from the dashboard

  1. Open Settings → Workflows and choose Ingest.
  2. Pick one of the hive’s repositories in Repository, or type it in or owner/repo.
  3. Optionally set Save as (the model name; the default is derived from the repository).
  4. Choose Preview to see the result without saving, or Ingest and save to store it as the next version of that model.

The result shows whether the model compiles, its Diagnostics and a Proposed columns diagram. Open in editor loads the draft on the editor canvas so you can review it before saving. A saved model appears in the Library with provenance ingested-unreviewed.

Nothing is bound by ingest. To use the model for a repository, select it in that repository’s Workflow select on Settings → Repos.

Import with the API

POST /api/workflows/ingest takes exactly one of:

FieldTypeMeaning
repostring, owner/nameFetch the repository’s default branch through the hive’s GitHub credential
filesobject, path → file contentsIngest pasted files; paths are repository-relative, such as .github/workflows/ci.yml

and optionally:

FieldTypeMeaning
savebooleanStore the result at the next free integer version (HTTP 201 with entry)
namestringModel name; the default is a slug of the repository (local-pasted for pasted files)

Calls need an owner session, or the hive’s dashboard token sent as a bearer token. A hive reached through a direct route accepts only per-user sessions.

Ingest a repository and save the result:

curl -s -X POST https://hive.example/api/workflows/ingest \
  -H "Authorization: Bearer $HIVE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"repo": "example-org/example-app", "save": true}'

Preview two local workflow files without saving (jq builds the JSON body):

jq -n \
  --rawfile ci .github/workflows/ci.yml \
  --rawfile release .github/workflows/release.yml \
  '{name: "example-app-ci",
    files: {".github/workflows/ci.yml": $ci,
            ".github/workflows/release.yml": $release}}' |
curl -s -X POST https://hive.example/api/workflows/ingest \
  -H "Authorization: Bearer $HIVE_TOKEN" \
  -H "Content-Type: application/json" \
  -d @-

The response is a JSON object:

FieldMeaning
modelThe proposed WorkflowModel
compiledWhether the model compiles; ingested models normally compile with inferred-element warnings
diagnosticsCompiler diagnostics (code, severity, subject, detail)
profileThe compiled profile, when the model compiles
refThe revision read (empty for pasted files)
filesHow many files were read
pipelinesHow many pipelines were found
entryThe stored library entry, when save was set

Errors: 400 when both or neither of repo and files are set, or repo is not owner/name; 403 without the owner role; 502 when the repository could not be fetched; 503 when the hive has no GitHub client.

What ingest reads

  • Workflow files directly under .github/workflows/ ending in .yml or .yaml. Subdirectories and composite action files (action.yml) are not workflows and are skipped.
  • The process files the intake half of ingest reads (issue and pull-request templates, CONTRIBUTING.md, CODEOWNERS, OWNERS, MAINTAINERS, label files) and Tekton YAML, when they are present. Those add intake, triage, roles and Tekton pipelines; see Workflow models and Importing Tekton pipelines.
  • Files over 2 MiB are skipped and reported as file-too-large.

How workflows map into the model

Each workflow file becomes one entry in spec.pipelines:

GitHub ActionsModel field
file pathpath; the id is gha- plus a slug of the path, for example gha-github-workflows-ci
name:name (the file name without extension when absent)
on: events, with types, branches, tags, paths and crontriggers[] (*-ignore filters are kept with a leading !)
each job, in file ordera node in nodes[], kind: job (or reusable-workflow for a job with uses:, with the reference in ref)
needs:the node’s needs: these are the DAG’s edges
environment:, if:, runs-on:environment, if, runsOn on the node
strategy.matrixmatrix summary: the keys, the include and exclude counts, and dynamic when it is an expression. The matrix is not expanded
concurrency:concurrency (group, cancelInProgress)

Every node gets a topological level (0 for jobs with no needs), and the pipeline records how many levels it has. A needs that names no job is dropped and reported; a cycle in needs resets the levels and is reported.

The pipeline’s role comes from its triggers, first match wins:

TriggersRoleWhere it binds
pull_request, pull_request_target or merge_grouppr-verifyEvery state in the CI / Review column
push with tag filters, or releasereleaseA Release column after Merged
pushpush-verifyA Main CI column after Merged
workflow_dispatch with a job that has an environment, or deployment / deployment_statusdeployOne Deploy: <environment> column per literal environment, or one Deploy column
schedule only (optionally with a manual trigger)scheduledListed, not bound to a state
workflow_dispatch onlymanualListed, not bound to a state
anything else, including workflow_call onlyotherListed, not bound to a state

A workflow with several triggers binds to every role its triggers imply. A workflow on both pull_request and push appears under CI / Review and under Main CI. When any post-merge pipeline exists, Merged is followed by the post-merge columns and a final Done column, linked by a pipeline-succeeded event (pipeline.status is green).

Every state the ingest adds is confidence: inferred and cites the workflow file it came from. Constructs that ingest recognises but does not model are listed in spec.coverage.findings with a stable code, for example job-container (a job’s container or services), secrets-inherit, reusable-only, environment-on-pr, needs-unresolved, needs-cycle, concurrency-expression, job-empty, no-jobs, yaml-parse and not-a-workflow. A malformed file never fails the ingest; it is counted and reported.

What is and is not executed

Done by
Running jobs and steps, matrices, retries, caching, secretsGitHub Actions, unchanged
Reading the workflow files and building the DAGHive, at ingest time only
Deriving an item’s lifecycle stateHive, from facts it observes (checks, reviews, labels), once the model is bound and derivation is on
Moving merged PRs through Main CI, Release and DeployNot yet: live derivation reports pipeline.status as unknown, so these columns render but stay empty

Simulate on a model’s detail page is the one place that reads post-merge runs today: given a merged pull request (owner/repo#123, Fetch facts), it reads the GitHub Actions runs of the model’s bound post-merge pipelines on the default branch and fills pr.pipeline, so you can see where the model would place that PR.

How it shows in the dashboard

  • Ingest view: compile badge, diagnostics and the Proposed columns diagram.
  • Library and model detail (Settings → Workflows): one row per name@version with its provenance and compile status; the detail page shows the diagram, diagnostics, citations and the raw model JSON, including spec.pipelines.
  • Editor: the inferred states are drawn dashed, each with a Confirm action, and the toolbar’s Confirm all inferred confirms them all; saving a confirmed copy gives it provenance local.
  • Activity Monitor: once the model is bound on Settings → Repos, the repository’s rows use the model’s columns, including Main CI, Release, Deploy and Done when the ingest found post-merge pipelines.

Worked example

.github/workflows/ci.yml runs lint and a test matrix in parallel, then a build that needs both:

name: CI
on: [pull_request, push]
concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: make lint
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go: ["1.22", "1.23"]
    steps:
      - uses: actions/checkout@v4
      - run: make test
  build:
    needs: [lint, test]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: make build

.github/workflows/release.yml publishes on version tags:

name: Release
on:
  push:
    tags: ['v*']
jobs:
  publish:
    runs-on: ubuntu-latest
    environment: production
    steps:
      - run: make publish

Ingesting both files gives two pipelines. ci.yml has two levels: lint and test at level 0, build at level 1.

[
  {
    "id": "gha-github-workflows-ci",
    "name": "CI",
    "system": "github-actions",
    "path": ".github/workflows/ci.yml",
    "role": "pr-verify",
    "triggers": [{ "event": "pull_request" }, { "event": "push" }],
    "nodes": [
      { "id": "lint", "kind": "job", "runsOn": ["ubuntu-latest"], "level": 0 },
      { "id": "test", "kind": "job", "matrix": { "keys": ["go"] }, "runsOn": ["ubuntu-latest"], "level": 0 },
      { "id": "build", "kind": "job", "needs": ["lint", "test"], "runsOn": ["ubuntu-latest"], "level": 1 }
    ],
    "concurrency": { "group": "ci-${{ github.ref }}", "cancelInProgress": true },
    "levels": 2
  },
  {
    "id": "gha-github-workflows-release",
    "name": "Release",
    "system": "github-actions",
    "path": ".github/workflows/release.yml",
    "role": "release",
    "triggers": [{ "event": "push", "tags": ["v*"] }],
    "nodes": [
      { "id": "publish", "kind": "job", "environment": "production", "runsOn": ["ubuntu-latest"], "level": 0 }
    ],
    "levels": 1
  }
]

CI runs on pull_request, so it is bound to every CI / Review state, each citing .github/workflows/ci.yml. Because it also runs on push, it fills a Main CI column after Merged; Release fills a Release column; a final Done column closes the chain. The columns the ingest appends after hive-default’s seven:

[
  { "id": "main-ci", "label": "Main CI", "hint": "Runs after merge: gha-github-workflows-ci", "states": ["main-ci"] },
  { "id": "release", "label": "Release", "hint": "Runs after merge: gha-github-workflows-release", "states": ["release"] },
  { "id": "done", "label": "Done", "hint": "Every post-merge pipeline has run", "states": ["done"], "terminal": true }
]

and the transitions that link them:

[
  { "from": "merged", "to": "main-ci", "on": "pipeline-succeeded", "note": "ingested post-merge chain" },
  { "from": "main-ci", "to": "release", "on": "pipeline-succeeded", "note": "ingested post-merge chain" },
  { "from": "release", "to": "done", "on": "pipeline-succeeded", "note": "ingested post-merge chain" }
]

spec.meta.source is github-actions and spec.meta.provenance is ingested-unreviewed. The environment: production on publish does not add a Deploy column: environments only create deploy columns for pipelines whose role is deploy.

Next steps

  • Review the draft in the editor, confirm the inferred states, then bind it on Settings → Repos.
  • Use Simulate on the model’s detail page to check where real issues and PRs would land.
  • To hand states to agents, add agent grants; see Workflow models and Agent configuration.