Skip to content
Sengi

Migrate GitHub Actions with your coding agent

Can I migrate GitHub Actions to Sengi with a coding agent?

Yes. Paste the prompt on this page into Claude Code, Codex or Cursor. It reads every workflow in the repository, switches each eligible job's runs-on line to sengi-basic-2-ubuntu-2404, sengi-basic-4-ubuntu-2404 or sengi-basic-8-ubuntu-2404, and opens a pull request you review and merge. No config file, no token to copy, no YAML editing. Sengi Basic starts at $0.001/min for 2 vCPU, 83% below GitHub’s Linux 2-core minute rate.

It works with any agent that can run the gh CLI: Claude Code, Codex, Cursor, Copilot's agent mode, Aider. The agent works with your own credentials, in your own checkout.

What do I need before I paste it?

  • The repository connected to Sengi. Sign up, choose Connect GitHub, and pick this repository. One step installs the App and connects it.
  • The gh CLI signed in as someone who can push to the repository.

The prompt checks both before it touches anything.

What is the prompt?

Copy this whole thing. An agent that fetches rather than reading a paste can take it from https://sengi.run/agent.md, which serves these same bytes as plain text.

Migrate GitHub Actions to Sengi runners
# Migrate GitHub Actions to Sengi runners

Migrate this repository's workflows from GitHub-hosted runners to Sengi runners.
Keep GitHub Actions; change the `runs-on` line of each supported job (plus one
caching line for `astral-sh/setup-uv`, see Step 5), and open a pull request the
user reviews.

**Prerequisites:** `gh` CLI authenticated, and the repository connected to a Sengi
project at https://app.sengi.run — installing the GitHub App alone is not enough,
see Step 1.

## Configuration

| Setting | Value |
| --- | --- |
| Default target | `sengi-basic-2-ubuntu-2404` (2 vCPU, 8 GB) or `sengi-premium-2-ubuntu-2404` (2 vCPU, 8 GB), as the user picks in Step 5 |
| Larger targets | `sengi-basic-4-ubuntu-2404` (4 vCPU, 16 GB), `sengi-basic-8-ubuntu-2404` (8 vCPU, 32 GB), `sengi-premium-4-ubuntu-2404` (4 vCPU, 16 GB), `sengi-premium-8-ubuntu-2404` (8 vCPU, 32 GB) |
| Replaceable source labels | `ubuntu-latest`, `ubuntu-24.04` |
| Branch | `migrate-to-sengi-runners` |

Sengi runs Ubuntu 24.04 on x64 only. Every Sengi label above is a complete label —
do not abbreviate one, and do not invent a size that is not in this table. Do not
write the older `sengi-standard-` labels: they still run, as Premium, but are not
for new workflows.

Replace all UPPERCASE placeholders (`OWNER`, `REPO`, `BRANCH_NAME`, `HEAD_OID`,
`BASE64_CONTENT`, `FILE_NAME`, `N`, `DEFAULT_BRANCH`, `PROJECT_ID`) with actual values from
previous steps.

## Procedure

### Step 1: Confirm the repository is connected to Sengi

Ask the user:

> Is this repository connected to a Sengi project? Go to https://app.sengi.run,
> sign up, choose **Connect GitHub**, and pick this repository when
> GitHub asks which repositories to grant. That single step installs the App and
> connects the repository. Tell me when it is done.

Installing the Sengi GitHub App straight from GitHub does **not** connect the
repository — Sengi connects it when you pick it in that flow, and a job on an
unconnected repository queues forever instead of failing.

**Optional check.** If the user has already given you a Sengi API token in
`SENGI_TOKEN` and the project id (`pj…`, shown in the project's URL), read the
connection yourself instead of relying only on their word. Never ask the user to
create or paste a token for this; without one, the user's confirmation is the check.
Never print `$SENGI_TOKEN` or put it in a commit, pull request or log.

```bash
curl -fsS -H "Authorization: Bearer $SENGI_TOKEN" \
  https://api.sengi.run/project/PROJECT_ID/github/status
```

The token needs `Project:github`. In the JSON, find this repository (`name` is
`owner/repo`) under `installations[].repositories[]`:

- Connected: the repository's `refusal` is `null`. Go to Step 2.
- No such repository: it is not connected. Send the user to https://app.sengi.run
  to choose **Connect GitHub** and pick it, then check again once they say it is
  done.
- `refusal: "repository_disabled"`: the user turned this repository off in their
  Sengi project. They must turn it back on there.
- `refusal: "repository_not_connected"`: GitHub no longer shows Sengi this
  repository. The user must grant it to the Sengi App in GitHub's installation
  settings, or reconnect it at https://app.sengi.run.
- `refusal: "installation_not_active"` with `on_hold` true: Sengi is waiting to
  confirm the installation with GitHub. If `rechecking` is true, wait and check
  again every minute for up to 10 minutes. If it is still held, or `rechecking`
  is false, the user must open https://app.sengi.run and verify the connection.
- `refusal: "installation_not_active"` with `on_hold` false: the App was suspended
  or uninstalled on GitHub. The user must reconnect with **Connect GitHub** at
  https://app.sengi.run.
- `refusal: "project_runner_admission_stopped"`: runners are stopped for this
  project; the user must resume them at https://app.sengi.run.
- `setups[]` with `stage: "approval_needed"`: the GitHub organization's owner must
  approve the Sengi App request on GitHub. Tell the user, and check again once
  they say it is approved.
- Any other unfinished `setups[]` stage (for example `action_needed`): send the
  user to https://app.sengi.run and pass along its `error_code`. A setup with
  `resumable: true` can be continued there.
- Any other non-2xx response (`401`, `403`, a `404` from a wrong project id or a
  server without the endpoint) or a curl failure: fall back to asking the user.

A non-null `funding` object appears only if the token also holds `Project:billing`. Its
fields (`available_credits`, `exhausted`, `card_on_file`, `payment_accepted`,
`spending_cap_reached`) are inputs to whether free jobs are accepted, not the
answer: do not conclude jobs will or will not run from them. Report them, and
read the final answer from the first job in Step 7.

**Without a successful check, do not run any commands or proceed to Step 2 until
the user explicitly confirms.** After a successful check, tell the user what you
found and proceed.

Personal repositories are supported. The repository does not need to belong to an
organization.

### Step 2: Verify CLI auth and the workflow scope

Verify `gh auth status` succeeds. If not, direct the user to install `gh` from
https://cli.github.com/ and run `gh auth login`.

Writing a file under `.github/workflows/` needs the `workflow` scope, which
`gh auth login` does not grant by default. Check for it:

```bash
gh auth status 2>&1 | grep -o "Token scopes:.*"
```

If `workflow` is not listed, stop and have the user run
`gh auth refresh -h github.com -s workflow` before you continue. Without it the
commit in Step 6 is refused, after the branch has already been created.

### Step 3: Get the repository

Ask the user for the repository (`owner/repo`) unless the working directory already
identifies one, in which case confirm it. Then read its default branch and check the
user can push to it:

```bash
gh api repos/OWNER/REPO --jq '{default_branch, can_push: .permissions.push}'
```

If `can_push` is false, stop: opening a branch needs write access.

### Step 4: Discover workflows

Fetch every workflow file in one call:

```bash
cat <<'QUERY' | gh api graphql --input -
{
  "query": "query($owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { id nameWithOwner defaultBranchRef { name target { oid } } object(expression: \"HEAD:.github/workflows\") { ... on Tree { entries { name object { ... on Blob { text } } } } } } }",
  "variables": { "owner": "OWNER", "repo": "REPO" }
}
QUERY
```

`HEAD` in that expression is a Git ref, not a placeholder — do not replace it.

If the response is truncated or errors on size, fall back to REST: read the default
branch with `gh api repos/OWNER/REPO --jq '.default_branch'`, the HEAD SHA with
`gh api repos/OWNER/REPO/git/ref/heads/DEFAULT_BRANCH --jq '.object.sha'`, the file
list with `gh api repos/OWNER/REPO/contents/.github/workflows`, and each file with
`gh api repos/OWNER/REPO/contents/.github/workflows/FILE_NAME`. The `content` field
is base64 — decode it before scanning.

Save `defaultBranchRef.name`, `.target.oid` and the `entries[]`. For each `.yml` or
`.yaml` file, read every job under `jobs:` and classify it.

**A job is eligible when all of these hold:**

- the job is an ordinary mapping with its own steps — it has no `uses:` key;
- its `runs-on:` is a single-line scalar, plain or quoted, on one line;
- that scalar contains no `${{ … }}` expression;
- that scalar is one of the replaceable source labels in the table above.

**A job is not eligible when any of these hold.** Report each with its reason:

| Shape | Reason to report |
| --- | --- |
| `runs-on: ubuntu-22.04`, `ubuntu-20.04` | Sengi runs Ubuntu 24.04 only |
| `runs-on: windows-*`, `macos-*` | Sengi runs Linux x64 only |
| `runs-on: ubuntu-latest-16-cores` and other larger runners | not a Sengi size |
| `runs-on: [self-hosted, linux, ubuntu-latest]` (an array) | Sengi takes one label, not a list — needs manual review |
| `runs-on: ${{ matrix.os }}` or any expression | the label is decided at runtime — needs manual review |
| `runs-on: { group: …, labels: [ … ] }` | group syntax — needs manual review |
| a job with `uses:` (a reusable workflow) | the runner is chosen in the called workflow |
| no `runs-on:` at all | nothing to change |

A job with a `strategy:`/`matrix:` block **is** eligible as long as its own
`runs-on:` is a literal supported label — the matrix multiplies the job, it does
not choose the runner. Only `runs-on` that reads *from* the matrix is ineligible.

**Whole files to skip,** because a targeted one-line edit is not safe in them: any
file using YAML anchors or aliases (`&name`, `*name`, `<<:`), explicit tags, a
`%YAML` directive, a duplicate key, or more than one YAML document — that means two
documents separated by a `---` line, **not** a file that merely opens with `---`,
which is ordinary and fine. Report these as "needs manual review".

Also check whether the repository lints its workflows. If `.github/actionlint.yaml`
or `.github/actionlint.yml` exists, or a workflow runs actionlint, the Sengi labels
must be declared there or that lint job fails on the pull request before any job
reaches Sengi. Add the labels you are about to use under `self-hosted-runner.labels`
in that file, in the same commit, and say so in the summary:

```yaml
self-hosted-runner:
  labels:
    - sengi-basic-2-ubuntu-2404
```

If the repository runs actionlint but has no config file, create it with only that
key. This is the one file other than a workflow you may change, and only for this.

Show the user a summary: the workflows that will change, the label each job moves
from and to, and every job not migrated with its reason from the table.

If nothing is eligible, stop and say so.

### Step 5: Choose sizes and preview

**Never create a pull request before the user confirms the changes.**

Ask the user whether they want Basic or Premium before you change anything:
Basic for the lowest cost, Premium for faster builds (see What Sengi costs). Then
default every eligible job to that tier at 2 vCPU: `sengi-basic-2-ubuntu-2404` or
`sengi-premium-2-ubuntu-2404`. That is the like-for-like size for a standard GitHub Linux runner.
If no one is there to answer, use `sengi-basic-2-ubuntu-2404`, the label Sengi's
runner sizes page matches to `ubuntu-latest`, and say in the pull request which
tier you chose and that swapping `basic` for `premium` in a label moves that job
to Premium.
Offer the larger sizes for jobs the user says are slow or memory-hungry; each step
up doubles both the machine and the price, and one job can be a different size or
tier from its neighbours in the same file.

Then show the exact diff per workflow. The rules for writing it:

- change **only** the `runs-on` scalar, never the surrounding lines;
- preserve the file byte for byte otherwise — indentation, key order, comments,
  blank lines, quote style and the trailing newline;
- if the old label was quoted, keep the quotes and replace what is inside them;
- skip commented-out lines.

**uv caching.** If a migrated job uses `astral-sh/setup-uv`, add `enable-cache: true`
under that step's `with:` (create `with:` if the step has none) and pin the action to
`astral-sh/setup-uv@v10.3.2` or later. setup-uv's default `enable-cache: auto` only
caches on GitHub-hosted runners, so without this line uv caching is off on Sengi and
every run reinstalls from scratch. setup-uv has no floating `v10` tag, so use the full
version:

```yaml
- uses: astral-sh/setup-uv@v10.3.2
  with:
    enable-cache: true
```

If the step already sets `enable-cache`, leave it. These are the only lines besides
`runs-on` you may change.

The diff a reviewer sees should be one changed `runs-on` line per migrated job, plus
the setup-uv lines where a job uses it, and nothing else.

### Step 6: Open the pull request

**Branch.** Check for an existing branch first:

```bash
gh api repos/OWNER/REPO/git/matching-refs/heads/migrate-to-sengi-runners --jq '.[].ref'
```

If any exist, take the highest numeric suffix and add one — `-2` if none has a
suffix. Then create it:

```bash
gh api repos/OWNER/REPO/git/refs -f ref=refs/heads/BRANCH_NAME -f sha=HEAD_OID
```

**Commit.** One atomic commit for every file, contents base64-encoded. This creates
a verified commit without touching the user's git config:

```bash
cat <<'MUTATION' | gh api graphql --input -
{
  "query": "mutation($input: CreateCommitOnBranchInput!) { createCommitOnBranch(input: $input) { commit { oid url } } }",
  "variables": {
    "input": {
      "branch": {
        "repositoryNameWithOwner": "OWNER/REPO",
        "branchName": "BRANCH_NAME"
      },
      "message": {
        "headline": "Migrate N CI workflows to Sengi runners",
        "body": "Replaced runners per file:\n- file1.yml: ubuntu-latest → sengi-basic-2-ubuntu-2404\n- file2.yml: ubuntu-24.04 → sengi-basic-4-ubuntu-2404"
      },
      "expectedHeadOid": "HEAD_OID",
      "fileChanges": {
        "additions": [
          { "path": ".github/workflows/FILE_NAME", "contents": "BASE64_CONTENT" }
        ]
      }
    }
  }
}
MUTATION
```

Check the response carries a `commit.oid`. On an `expectedHeadOid` mismatch, read the
head of **the branch you just created** — not the default branch, whose SHA is the
one that just mismatched — and retry the commit once with that value:

```bash
gh api repos/OWNER/REPO/git/ref/heads/BRANCH_NAME --jq '.object.sha'
```

On any other error, report it and stop — never open a pull request on top of a
failed commit.

`N` is the count of changed workflow files.

**Pull request:**

```bash
gh pr create --repo OWNER/REPO --head BRANCH_NAME --base DEFAULT_BRANCH \
  --title "Migrate N CI workflows to Sengi runners" --body "..."
```

Body:

```
## Summary
Moves CI from GitHub-hosted runners to Sengi runners. Same GitHub Actions, same
workflows, same logs — only the `runs-on` line changes.

## Changes
- `file1.yml`: `ubuntu-latest` → `sengi-basic-2-ubuntu-2404`
- `file2.yml`: `ubuntu-24.04` → `sengi-basic-4-ubuntu-2404`

## Not migrated
- `file3.yml` (job `build`): uses `${{ matrix.os }}` — needs manual review
(or "Every eligible job was migrated.")

## After merging
The next run of these workflows executes on Sengi. Logs, statuses and required
checks stay in GitHub. To undo it, revert this pull request.
```

### Step 7: After the merge

Offer to check the first run. When the user says the pull request is merged:

```bash
gh run list --repo OWNER/REPO --branch DEFAULT_BRANCH --limit 5 \
  --json status,conclusion,name,createdAt,databaseId
```

Look for runs created after the merge.

- A job that reaches `in_progress` is working. A runner that is not already warm has
  to be provisioned first, so allow around a minute before reading anything into a
  job that is still queued.
- A job still `queued` after a few minutes has **three** likely causes, in this
  order. Do not assert the first one without ruling out the others:
  1. **The repository is not connected.** Most likely if *no* job has ever started.
     If you have a token, run the Step 1 status check and read its `refusal`;
     otherwise send the user to https://app.sengi.run to check this repository is listed.
  2. **The free account's concurrency limit.** A free account runs at most 12 vCPU
     at once — for example six 2-vCPU jobs, three 4-vCPU jobs, or one 8-vCPU job
     beside two 2-vCPU jobs. Jobs over that line wait for a running one to finish,
     which is normal and resolves itself.
     Suspect this first when some jobs started and others did not, and especially
     after migrating a matrix job that fans out wider than six.
  3. **The monthly free allowance is spent.** New free jobs wait until the next UTC
     month; jobs already running finish. The user can see this in their project.
- A job that fails on a step that passed on GitHub-hosted runners is worth
  reporting: give the user the failing step and the run URL.

## Error handling

| Error | What to do |
| --- | --- |
| `gh` missing or logged out | Install from https://cli.github.com/, run `gh auth login` |
| Token lacks the `workflow` scope | `gh auth refresh -h github.com -s workflow`, then retry |
| The pull request's own lint fails on an unknown runner label | actionlint — declare the label under `self-hosted-runner.labels` in `.github/actionlint.yaml` |
| 403 / insufficient permissions | The user needs write access to the repository |
| Repository not found | Check the name and the user's access |
| No `.github/workflows` | Nothing to migrate; stop |
| 422 creating the branch | The branch exists — add a numeric suffix |
| `expectedHeadOid` mismatch | Re-fetch the HEAD SHA and retry the commit once |
| GraphQL response truncated | Fall back to the REST calls in Step 4 |
| Rate limit exceeded | Wait a few minutes and retry |
| Jobs stay `queued` after merge | Check all three causes in Step 7 before blaming the connection |
| A job needs Ubuntu 22.04, Windows, macOS or arm64 | Leave it on GitHub-hosted runners |

## What Sengi costs

Basic costs $0.001 a minute for 2 vCPU with 8 GB, $0.002 for 4 vCPU with
16 GB, and $0.004 for 8 vCPU with 32 GB. Each job's execution time rounds
up to a whole minute; boot and teardown are not billed. New accounts get
3,000 free credits each month, on Basic or Premium: on Basic that is 3,000
minutes at 2 vCPU, 1,500 at 4 vCPU, 750 at 8 vCPU, or any mix, and a Premium
minute uses 3 times the credits of a Basic minute of the same size. Credits
reset monthly and do not carry over.
No card required to start. Paid usage is opt-in; no subscription or base fee.

Premium costs $0.003/$0.006/$0.012 a minute for 2/4/8 vCPU.
Its labels are sengi-premium-2-ubuntu-2404, sengi-premium-4-ubuntu-2404
and sengi-premium-8-ubuntu-2404. Basic for value, Premium for speed: Basic
is built to match GitHub's own runners at the lowest price; Premium runs on
bare metal gaming CPUs with local NVMe, for speed (measured
against GitHub's runner at https://sengi.run/benchmarks). Ask the user
which they want before editing. Existing sengi-standard labels continue to
work as Premium.

Reading this without JavaScript, or where the clipboard is blocked? Select the block and copy it, or run curl -s https://sengi.run/agent.md.

What does it do, in order?

  1. Asks you to connect the repository and waits for you to say it is done. It runs no commands until then.
  2. Checks gh auth status and that you can push to the repository.
  3. Reads every workflow in .github/workflows in one GraphQL call, with a REST fallback for repositories too large for one response.
  4. Classifies each job as eligible or not, and tells you the reason for every job it will not touch.
  5. Shows you the diff and the size it picked for each job, and stops for your confirmation.
  6. Commits once, atomically, through the Git data API, and opens the pull request against your default branch.
  7. Offers to watch the first run after you merge.

Which runner size does it pick?

LabelMachineRateFree minutes a month
sengi-basic-2-ubuntu-24042 vCPU, 8 GB$0.001/min3,000
sengi-basic-4-ubuntu-24044 vCPU, 16 GB$0.002/min1,500
sengi-basic-8-ubuntu-24048 vCPU, 32 GB$0.004/min750

Every job defaults to 2 vCPU, the like-for-like replacement for GitHub's standard Linux runner, at $0.001/min on Basic. Tell the agent which jobs are slow and it puts those on 4 or 8 vCPU; jobs in the same file can use different sizes. Boot and teardown are never billed.

New accounts receive one shared monthly allowance of 3,000 free credits, on Basic or Premium: a Basic minute uses 1/2/4 credits by size, and a Premium minute uses 3 times the credits of a Basic minute of the same size. Choose Premium for any job that needs the speed.

All three run Ubuntu 24.04 x64 from the same image. To see what a month costs, use the GitHub Actions cost calculator.

What happens after you merge?

The next run of those workflows executes on Sengi, each job on its own fresh VM. Logs, statuses, annotations and required checks stay in GitHub, exactly where your team expects them. Your agent can watch the first run and confirm it landed on Sengi. To go back, revert the pull request.

Prefer to do it yourself? It is one line per job: set runs-on to a Sengi label and merge.

If a job uses astral-sh/setup-uv, also set enable-cache: true under its with: and pin astral-sh/setup-uv@v10.3.2 or later (there is no floating v10 tag). The action's default auto only caches on GitHub-hosted runners, so without it uv reinstalls everything on every run.

Frequently asked questions

Can my coding agent move my workflows to Sengi?

Yes. Copy the prompt on this page into Claude Code, Codex, Cursor or any agent that can run the GitHub CLI. It reads every workflow in the repository, finds the jobs Sengi runs, changes the runs-on line of each one, and opens a pull request for you to review. It asks before it changes anything and never merges. You connect the repository in one browser click; the agent does the rest.

What does the agent actually change?

One line per job: the value of runs-on. Steps, triggers, secrets, permissions, concurrency, caches and every other key stay exactly as they are, down to your indentation, comments and quote style. The one exception is astral-sh/setup-uv: its default cache is off outside GitHub-hosted runners, so the agent adds enable-cache: true and pins astral-sh/setup-uv@v10.3.2 or later. Your reviewer sees one changed line per migrated job, plus those lines, and nothing else.

Which jobs does it move?

Every job on ubuntu-latest or ubuntu-24.04 with a plain runs-on label. Jobs that belong on other runners, such as Windows, macOS or arm64, stay where they are, and the pull request lists each one with its reason.

Do I need a GitHub organization to use Sengi?

No. Sengi runs personal and organization repositories alike. You need write access to the repository so the agent can push a branch.

Why use a prompt instead of editing the files myself?

It is the same edit, done thoroughly. The agent reads every workflow in the repository, not just the two you remember, moves every job that fits, and hands you one pull request with its reasoning attached. You review and merge it; reverting it puts you back where you started.

Keep your workflow. Cut your runner rate.

Sengi Basic starts at $0.001 a minute for 2 vCPU. Choose 4 or 8 vCPU for $0.002 or $0.004 a minute. Premium stays optional at $0.003, $0.006 and $0.012.

Start without a card ↗︎

See Basic pricing · Switch with your coding agent