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. To have hive run a DAG on its own agents instead, author it natively as a DAG workflow, or import this workflow as a DAG workflow draft. The Tekton equivalent is Importing Tekton pipelines.
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:readon 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
- Open Settings → Workflows and choose Ingest.
- Pick one of the hive’s repositories in Repository, or type it in or owner/repo.
- Optionally set Save as (the model name; the default is derived from the repository).
- 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:
| Field | Type | Meaning |
|---|---|---|
repo | string, owner/name | Fetch the repository’s default branch through the hive’s GitHub credential |
files | object, path → file contents | Ingest pasted files; paths are repository-relative, such as .github/workflows/ci.yml |
and optionally:
| Field | Type | Meaning |
|---|---|---|
save | boolean | Store the result at the next free integer version (HTTP 201 with entry) |
name | string | Model 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:
| Field | Meaning |
|---|---|
model | The proposed WorkflowModel |
compiled | Whether the model compiles; ingested models normally compile with inferred-element warnings |
diagnostics | Compiler diagnostics (code, severity, subject, detail) |
profile | The compiled profile, when the model compiles |
ref | The revision read (empty for pasted files) |
files | How many files were read |
pipelines | How many pipelines were found |
entry | The 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.ymlor.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 Actions | Model field |
|---|---|
| file path | path; 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 cron | triggers[] (*-ignore filters are kept with a leading !) |
| each job, in file order | a 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.matrix | matrix 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:
| Triggers | Role | Where it binds |
|---|---|---|
pull_request, pull_request_target or merge_group | pr-verify | Every state in the CI / Review column |
push with tag filters, or release | release | A Release column after Merged |
push | push-verify | A Main CI column after Merged |
workflow_dispatch with a job that has an environment, or deployment / deployment_status | deploy | One Deploy: <environment> column per literal environment, or one Deploy column |
schedule only (optionally with a manual trigger) | scheduled | Listed, not bound to a state |
workflow_dispatch only | manual | Listed, not bound to a state |
anything else, including workflow_call only | other | Listed, 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, secrets | GitHub Actions, unchanged |
| Reading the workflow files and building the DAG | Hive, at ingest time only |
| Deriving an item’s lifecycle state | Hive, from facts it observes (checks, reviews, labels), once the model is bound and derivation is on |
| Moving merged PRs through Main CI, Release and Deploy | Not 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@versionwith its provenance and compile status; the detail page shows the diagram, diagnostics, citations and the raw model JSON, includingspec.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.
Import as a task workflow draft
The sections above make an observed pipeline inside a lifecycle model. A workflow file can
also be converted into a DAG workflow (task workflow) draft: a TaskWorkflow
whose steps hive runs on its own agents. This needs task workflows turned on
(workflow.tasks.enabled); while they are off the route answers 404.
The conversion takes only the shape of the workflow. Each job becomes a step, and needs
becomes depends_on. A job’s commands are never copied into a prompt, and nothing in the file
is executed or fetched: not the jobs, not the actions they use, not a reusable workflow they
call. The result is a draft that cannot run as it is:
- every step has no agent and no prompt, so the draft does not validate until an owner assigns an agent (or pool) and writes the prompt for each step;
- it carries no schedule and no notification target;
- saved, it is stored disabled, and an import never replaces an existing workflow.
Enabling it, and starting a run, stay separate owner actions after review.
POST /api/task-workflows/import (owner only):
| Field | Type | Meaning |
|---|---|---|
files | object, path → file text | The workflow files, for example {".github/workflows/ci.yml": "..."} |
system | string | github-actions or tekton; empty detects each file (.github/workflows/*.yml is GitHub Actions) |
name | string | The draft’s name; a prefix when several drafts result. The default is a slug of the workflow’s name: |
pipeline | string | Keep only the pipeline with this name or workflow-model id |
save | boolean | Store every draft, disabled (audited as task_workflow_imported) |
jq -n --rawfile ci .github/workflows/ci.yml \
'{files: {".github/workflows/ci.yml": $ci}, name: "ci-agents"}' |
curl -s -X POST https://hive.example/api/task-workflows/import \
-H "Authorization: Bearer $HIVE_TOKEN" \
-H "Content-Type: application/json" \
-d @-
The response has drafts[] and file-level findings[]. Each draft has workflow (the
TaskWorkflow), yaml (the same, for the editor), source (system, path, pipeline name and
id), step_sources (step id → job id), findings[] and diagnostics (validation, which lists
the missing agents and prompts). Open the YAML in the task workflow editor, complete it, then
save it enabled.
Limits: at most 16 files, 512 KiB per file and 2 MiB in all (413 above that), and at most
50 jobs per workflow (a larger workflow gives no draft and a too-many-steps finding).
What maps
| GitHub Actions | Task workflow draft |
|---|---|
| each job, in file order | a step; the id is the job id in lower case with other characters turned into - (reported as id-renamed when it changes) |
needs: | depends_on, rewritten to the step ids |
timeout-minutes: | the step’s timeout, kept within 1m to 24h (timeout finding when moved) |
workflow_dispatch and workflow_call inputs | spec.params with description, required and default |
What does not map
Every construct below is reported as a finding with a stable code, a severity
(unsupported: not in the draft, so the draft behaves differently; lossy: mapped
approximately; info: noted for the reviewer) and the step it concerns. None is dropped
silently.
| Code | Construct | What the draft does instead |
|---|---|---|
step-commands-not-carried | the job’s steps | Nothing; write the step’s prompt |
matrix | strategy.matrix | One step, run once |
services, container | service containers, a job container | The step runs on its agent |
if-condition | a job’s if: | The step runs whenever its dependencies succeed |
environment | environment: and its protection rules | Nothing; consider approval: required on the step |
continue-on-error | continue-on-error: | Nothing; on_failure: continue skips the step’s dependants instead |
results | job outputs | A later step reads the reported result as {{steps.<id>.result}} |
reusable-workflow | a job that calls uses: owner/repo/.github/workflows/x.yml@ref | One step; the called workflow is not fetched |
secret-reference | ${{ secrets.NAME }}, secrets in an if:, secrets: inherit, workflow_call secrets | Nothing; the finding carries the placeholder <secret:NAME>. Give the step’s agent its own credential |
secret-default-dropped | an input whose name says credential (token, secret, password, key, auth, cert) or whose default looks like one | The default is not carried; the param becomes required |
param-type | a choice input | A free-text param |
triggers-not-carried | on: events and schedule crons | Nothing; add spec.schedule or start runs from the API after review |
concurrency-not-carried | concurrency: | Nothing; spec.concurrency caps steps within a run |
dependency-dropped | a needs that names no job | The edge is dropped |
timeout | a timeout-minutes outside 1m to 24h | Raised or lowered into the range |
id-renamed, param-renamed | a job id or input name that is not a valid step id or param name | Renamed; a param that collides with another after renaming is not carried |
param-default-clipped | a default longer than 1 KiB | The default is not carried; the param becomes required |
too-many-params | more than 32 inputs | The rest are not carried |
incomplete-source | a file only partly readable (for example a duplicate key) | No draft; fix the file |
File-level findings: unrecognised-file (neither GitHub Actions nor Tekton), parse-error,
no-pipeline, too-many-steps (more than 50 jobs; no draft) and too-many-drafts (more than
20 pipelines in one call). A file path may be at most 512 bytes.
No secret value is ever carried: GitHub Actions files hold only secret names, and those appear only as placeholders in findings.
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.
- To have hive run the same DAG on its own agents, import it as a task workflow draft and complete it, or author it natively as a DAG workflow.