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 sectionIn Settings → Beacons, click Add beacon:
- Enter a Beacon name, such as "PR follow-up".
- Under Send to, choose GitHub Actions.
- Under Events, choose Guide ready, and Guide failed if you want it.
- 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/projectA new beacon receives only events recorded after you create it.
2. Add a workflow
Link to this sectionGitHub 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 sectionTo 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:
| Secret | What it is |
|---|---|
OPENAI_API_KEY or ANTHROPIC_API_KEY | Your model provider's key: OpenAI for Codex, Anthropic for Claude Code |
THESEUS_TOKEN | A Theseus personal token with read access to this workspace and repository |
THESEUS_PUSH_TOKEN | A 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 sectionGenerate a guide for a pushed PR, then find the beacon's ID:
theseus generate example/project#42 --wait
theseus webhooks listList its recent deliveries:
theseus webhooks deliveries int_YOUR_ID --limit 10The 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 sectionThe event type is theseus.<event type>, such as theseus.guide.ready. The fields are under github.event.client_payload:
| Field | Use |
|---|---|
event_id | Deduplicate retries and resends |
type, occurred_at, api_version | Which event, when, and the payload version |
repository | Theseus ID, GitHub ID and full name |
changeset | The PR's path, kind and number |
guide | Guide ID and the head_sha it describes (null on guide.failed when generation failed early) |
actor | Who triggered it, or null |
url | Link 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 sectionTheseus 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| Symptom | Check |
|---|---|
| Delivery succeeded but nothing ran | The workflow is on the default branch; types matches exactly |
| The template's run skipped its work | The 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 that | Catch up from event history |