Skip to content

GitHub Actions and CI

Start a CI workflow when Theseus finishes generating a guide for a pull request.

Run a GitHub Actions workflow when Theseus finishes a guide: notify your team, run extra CI checks, or have a coding agent act on the guide. A beacon sends a repository_dispatch event to the repositories you pick. Beacons can also send to your own HTTPS endpoint; the CLI and API call them integrations, with IDs that start int_.

Before you start

Link to this section
  • Be an owner or admin of a workspace whose plan includes MCP, which covers beacons (Plans and usage). If Settings → Beacons has no Add beacon button, the plan doesn't include them.
  • Grant the Theseus GitHub App access to the repository that should run the workflow.
  • Be able to push a workflow to that repository's default branch.

1. Create a beacon

Link to this section

In Settings → Beacons, click Add beacon:

  1. Enter a Beacon name, such as "PR follow-up".
  2. Under Send to, choose GitHub Actions.
  3. Under Events, choose Guide ready, and Guide failed if you want it.
  4. Choose the Repositories, then click Create beacon.

Or from the CLI; without --url, the beacon sends to GitHub Actions:

theseus webhooks create --name "PR follow-up" \
  --events guide.ready,guide.failed \
  --repository example/project

A new beacon receives only events recorded after you create it.

2. Add a workflow

Link to this section

GitHub reads repository_dispatch workflows only from the default branch. Save this as .github/workflows/theseus.yml there:

name: Guide ready
on:
  repository_dispatch:
    types: [theseus.guide.ready]
permissions: {}
jobs:
  receive:
    runs-on: ubuntu-latest
    steps:
      - name: Show the guide
        env:
          GUIDE_URL: ${{ github.event.client_payload.url }}
          EVENT_ID: ${{ github.event.client_payload.event_id }}
        run: |
          printf 'Event: %s\nGuide: %s\n' "$EVENT_ID" "$GUIDE_URL"

It prints the guide's link and changes nothing.

Let an agent make follow-up changes

Link to this section

To have an agent read the guide and push fixes to the PR, start from a complete template, Codex or Claude Code, rather than extending the workflow above. Save it under .github/workflows/ on the default branch and add these repository secrets:

SecretWhat it is
OPENAI_API_KEY or ANTHROPIC_API_KEYYour model provider's key: OpenAI for Codex, Anthropic for Claude Code
THESEUS_TOKENA Theseus personal token with read access to this workspace and repository
THESEUS_PUSH_TOKENA GitHub fine-grained token with Contents: Read and write on the repository

THESEUS_TOKEN and THESEUS_PUSH_TOKEN are optional. Without THESEUS_TOKEN, the agent can't read the guide through the Theseus API. Without the push token, the template pushes with the built-in GITHUB_TOKEN, and GitHub doesn't run CI on commits pushed that way. The push token's owner must be allowed to push to the PR branch, and your organization may need to approve the token.

The templates skip forks and events for a commit the PR has moved past, run one job per PR at a time, ignore repeated deliveries and stop after three fix commits. They refuse any fix that touches .github/ and never merge. Read the file before you enable it.

3. Check it end to end

Link to this section

Generate a guide for a pushed PR, then find the beacon's ID:

theseus generate example/project#42 --wait
theseus webhooks list

List its recent deliveries:

theseus webhooks deliveries int_YOUR_ID --limit 10

The delivery should show as succeeded, which means GitHub accepted the event, and the Actions tab should show a "Guide ready" run.

What the workflow receives

Link to this section

The event type is theseus.<event type>, such as theseus.guide.ready. The fields are under github.event.client_payload:

FieldUse
event_idDeduplicate retries and resends
type, occurred_at, api_versionWhich event, when, and the payload version
repositoryTheseus ID, GitHub ID and full name
changesetThe PR's path, kind and number
guideGuide ID and the head_sha it describes (null on guide.failed when generation failed early)
actorWho triggered it, or null
urlLink to the guide

Review and comment events add a review or comment reference; Events and replay covers the types and how to fetch full content.

If it doesn't work

Link to this section

Theseus tries a dispatch up to five times over about 30 minutes. A permission error stops at once: re-approve the GitHub App with the permission it asks for (contents: write). Once you've fixed the cause, click Resend on the delivery in the beacon's Delivery Log, or run:

theseus webhooks resend dlv_YOUR_ID
SymptomCheck
Delivery succeeded but nothing ranThe workflow is on the default branch; types matches exactly
The template's run skipped its workThe PR moved to a newer commit, is closed or from a fork, already has three fix commits, or the event was already handled
Deliveries failed for longer than thatCatch up from event history