Skip to content

Commit 0bf9339

Browse files
Merge pull request #168 from depot/docs-sync-updates
Update content from depot/app
2 parents 3cf9064 + 2e78f1b commit 0bf9339

File tree

8 files changed

+281
-36
lines changed

8 files changed

+281
-36
lines changed

content/ci/compatibility.mdx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ Depot CI executes GitHub Actions YAML workflows. The following tables list GitHu
130130
| Composite | Composite actions ||
131131
| Docker | Container actions ||
132132

133+
## GitHub checks
134+
135+
Depot CI automatically reports GitHub checks for each job in a workflow run. For more information, see [GitHub checks](/docs/ci/observability/github-checks).
136+
133137
## Limitations
134138

135139
### GitHub-only event triggers
@@ -183,4 +187,27 @@ Only Depot `runs-on` labels are supported. Any label that Depot doesn't recogniz
183187

184188
### Permissions
185189

186-
The following permissions are supported: `actions`, `checks`, `contents`, `id-token`, `metadata`, `packages`, `pull_requests`, `statuses`, `workflows`.
190+
The following permissions are supported: `actions`, `checks`, `contents`, `id-token`, `metadata`, `pull_requests`, `statuses`, `workflows`.
191+
192+
#### GitHub Packages authentication
193+
194+
Pushing and pulling from GitHub Packages registries using `secrets.GITHUB_TOKEN` doesn't work in Depot CI. GitHub's package registry servers only accept personal access tokens for authentication, not GitHub App tokens. This is a known GitHub limitation (see discussions: [Read GitHub Packages permission for GitHub App](https://github.com/orgs/community/discussions/24636) and [Using GitHub Packages with GitHub Apps](https://github.com/orgs/community/discussions/26920)).
195+
196+
For container images, you can use another registry instead, such as [Depot Registry](/docs/registry/overview). When using `depot/build-push-action`, replace the GHCR login and push steps with the `save` input:
197+
198+
```yaml
199+
- uses: depot/build-push-action@v1
200+
with:
201+
context: .
202+
project: <your-depot-project-id>
203+
save: true
204+
save-tags: |
205+
latest
206+
${{ github.sha }}
207+
```
208+
209+
See the [Depot Registry quickstart](/docs/registry/quickstart) for pulling images and other usage.
210+
211+
This limitation applies to all GitHub Packages registries, not just the container registry. If you need to keep using a GitHub Packages registry, you can authenticate with a GitHub [personal access token](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic) with `write:packages` scope, [stored as a Depot CI secret](/docs/ci/how-to-guides/manage-secrets-and-variables).
212+
213+
Note that a PAT is a long-lived credential scoped to a user account, so consider the security implications of storing and rotating it.
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
title: Use Depot CI in coding agent loops
3+
ogTitle: How to use Depot CI CLI commands for coding agent loops
4+
description: Learn how to get your coding agent iterating locally with Depot CI.
5+
---
6+
7+
Depot CI is built for programmatic use, so it's a natural fit for AI coding agents. Instead of the usual push-wait-guess cycle, an agent can run CI locally, read the failure, fix the code, and rerun, all in a closed loop from your terminal.
8+
9+
This guide provides an example of how to set up that loop. The guide covers Claude Code and Cursor, but the pattern works for any agent with shell access.
10+
11+
## The agent loop
12+
13+
You're working with an agent on a task, and you want to make sure CI passes before moving on or pushing your changes.
14+
15+
No human needs to approve each step. You tell the agent to fix CI, and the agent iterates until it's done.
16+
17+
![Agent fix-CI loop: tell agent to fix CI, agent triggers run scoped to
18+
smallest job, checks status, reads logs from failed jobs, SSHs into runner if
19+
logs aren't enough, fixes code, reruns until CI
20+
passes](/images/docs/agent-loop.png)
21+
22+
For a raw narrative version of this pattern, see the blog post [The End of push-wait-guess CI](/blog/the-end-of-push-wait-guess-ci).
23+
24+
## Why the CLI works well for agents
25+
26+
Most coding agents already have a shell. The Depot CLI gives them CI without any HTTP plumbing. `depot ci run` tests workflows against your local working tree without requiring a commit or push. That's what makes the agent loop work: the agent can edit code and rerun CI in a tight loop without polluting the git history or waiting on long-running CI in GitHub.
27+
28+
- `depot ci run` starts a run against your local working tree. Use `--job` to scope to specific jobs for faster iteration. The CLI resolves job dependencies automatically.
29+
- `depot ci status` shows the full run hierarchy, workflows, jobs, and attempts with their statuses.
30+
- `depot ci logs` fetches the log output for a failed job so the agent can read the error and fix it.
31+
- `depot ci ssh` connects directly to a running sandbox via the Depot API, giving you (or the agent) an interactive shell on the runner. To keep a sandbox alive at the right moment, use `depot ci run --ssh-after-step <n>` to inject a tmate debug pause after a specific step, then connect with `depot ci ssh` or the tmate connection string from the logs.
32+
33+
## Prerequisites
34+
35+
- Complete the Depot CI [quickstart](/docs/ci/quickstart).
36+
- Run `depot login` or set `DEPOT_TOKEN` so the agent can authenticate.
37+
- An AI coding agent with shell access (such as Claude Code or Cursor).
38+
39+
## Install the Depot skills
40+
41+
Install [Depot skills](https://github.com/depot/skills) to teach your agent how to get started with Depot and use all the Depot CLI commands for Depot CI.
42+
43+
To install Depot skills with [skills.sh](https://skills.sh/), run `npx skills add depot/skills`.
44+
45+
## Set up the fix CI loop command
46+
47+
With the skills installed, create a command that tells the agent to use them, defines the loop, and sets the boundaries for what the agent can do autonomously.
48+
49+
The example command for this guide is `/fix-ci`.
50+
51+
Add a markdown file that defines the command to your repo. For example, in `.claude/commands/` or `.cursor/commands/`.
52+
53+
Example `fix-ci.md`:
54+
55+
```markdown
56+
Fix a Depot CI workflow, run, or job until it is green.
57+
58+
### Before you start
59+
60+
Invoke the `depot-ci` skill to load the full CLI reference. Then drive the debug loop.
61+
62+
### Inputs
63+
64+
Accept any of:
65+
66+
- a workflow path (for example, `.depot/workflows/ci.yml`)
67+
- a run ID, job ID, or attempt ID
68+
- a target job name (for example, `build`)
69+
- a natural-language goal (for example, "make the test job pass")
70+
71+
If the request is ambiguous, ask for the narrowest useful target.
72+
73+
### The Loop
74+
75+
1. **Run** the workflow against local changes, scoped to the smallest useful job.
76+
2. **Check status** and **read logs** for failed jobs.
77+
3. If logs aren't enough, connect to the running sandbox with **`depot ci ssh`**, or **rerun with `--ssh-after-step`** to pause at a specific step first.
78+
4. **Fix locally** based on what you found.
79+
5. **Rerun.** Repeat until green.
80+
81+
### Autonomy
82+
83+
The agent may: run workflows, inspect status/logs, SSH into runners, edit local files, and rerun until green.
84+
85+
Ask before: changing secrets or vars, altering deploy or release behavior, opening a PR, or large refactors beyond the immediate fix.
86+
87+
### When done, report
88+
89+
- what was targeted
90+
- what was wrong
91+
- what changed
92+
- proof of green (or the exact remaining blocker)
93+
```
94+
95+
The key ingredients are the same for any agent: install the skill so the agent has the CLI reference, then give it a command or prompt that describes the run-status-logs-ssh loop and the autonomy boundaries.
96+
97+
## Give the agent permission to run the loop
98+
99+
For the agent to iterate autonomously, it needs permission to run `depot` commands without prompting. How you configure permissions depends on your agent. Here are some examples.
100+
101+
### Claude Code permissions
102+
103+
Add a permission rule to `.claude/settings.json` to allow any Depot command:
104+
105+
```json
106+
{
107+
"permissions": {
108+
"allow": ["Bash(depot *)"]
109+
}
110+
}
111+
```
112+
113+
### Cursor permissions
114+
115+
Add a permission rule to `<project>/.cursor/cli.json` to allow any Depot command:
116+
117+
```json
118+
{
119+
"permissions": {
120+
"allow": ["Shell(depot)"]
121+
}
122+
}
123+
```
124+
125+
## Run the agent loop
126+
127+
Type `/fix-ci .depot/workflows/ci.yml` (for example) in your agent chat and watch the agent take over. You can adjust your custom command using the tips in the following section.
128+
129+
## Tips for customizing your agent loop
130+
131+
### Iteration limits
132+
133+
Cap the number of CI attempts so the agent doesn't loop forever on a fundamentally broken build. Three to five attempts is a reasonable default.
134+
135+
### Log truncation
136+
137+
CI logs can be long. If your agent has a limited context window, truncate logs to the last N lines or extract just the error output. Most failures surface near the end of the log.
138+
139+
### Polling
140+
141+
`depot ci status` returns immediately. It doesn't block until the run finishes. Agents will naturally poll by calling the status command in a loop. This works fine in practice.
142+
143+
### Human approval gates
144+
145+
If the agent shouldn't take certain actions autonomously, configure your agent's permission model to require approval for those commands. The `/fix-ci` command definition in the example includes suggested boundaries: the agent can run workflows, read logs, SSH in, and edit code, but should ask before changing secrets, deploying, or opening PRs.
146+
147+
### Untracked files aren't patched
148+
149+
`depot ci run` only includes tracked files in the local patch. If you've added a new file, use `git add` before running the agent, or add that step to your agent loop.
150+
151+
## What's next
152+
153+
The pattern in this guide is one way to implement a coding agent loop that uses Depot CI to iterate locally. Experiment with skills or sub agents or a mixture of these to create patterns that work for you. You can create more custom commands for managing or monitoring workflows with Depot CI. Learn more about the [Depot CI CLI commands](/docs/cli/reference/depot-ci) that your agents can use.

content/ci/how-to-guides/custom-images.mdx

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,27 @@ description: Learn how to snapshot a Depot CI sandbox that includes your tools a
66

77
import {NoteCallout} from '~/components/blog/NoteCallout'
88

9-
You can build a custom image in Depot CI using a job that runs only your setup steps on the Depot base image. After your setup steps complete, the snapshot action captures the state of the sandbox environment and pushes it to the Depot registry as a reusable image. Any job can then use that snapshot as its starting image, skipping the setup steps entirely.
9+
Build a reusable custom image from the Depot base image that includes your tools and dependencies.
10+
11+
## How it works
12+
13+
You build a custom image in Depot CI using a job that runs only your setup steps on the Depot base image. After your setup steps complete, a Depot snapshot action captures the state of the sandbox environment and pushes it to the Depot registry as a reusable image. Any job can then use that snapshot as its starting image, skipping the setup steps entirely.
1014

1115
<NoteCallout fullWidth>
12-
The snapshot action can only be used in workflows running on Depot CI. It is not compatible with GitHub Actions or
16+
The snapshot action can only be used in workflows running on Depot CI. It's not compatible with GitHub Actions or
1317
other CI providers.
1418
</NoteCallout>
1519

1620
## Snapshot a sandbox to build a custom image
1721

1822
Create a job that runs on a standard Depot sandbox and installs the tools and dependencies you want to bake in. This is a separate workflow that only creates your custom image and pushes it to the Depot Registry. You'll need to run this workflow initially to create the image and then only when dependencies change.
1923

24+
<NoteCallout fullWidth>
25+
Actions that set or change environment variables (such as actions/setup-node) need to be in both the build image
26+
workflow and the workflows that use the custom image. See [Environment variable changes don't persist in custom
27+
images](#environment-variable-changes-dont-persist-in-custom-images).
28+
</NoteCallout>
29+
2030
To create the build image workflow:
2131

2232
- Add [`depot/snapshot-action`](https://github.com/depot/snapshot-action) as a step (after your setup steps). It captures the full state of the sandbox environment and pushes it to the Depot registry as a reusable image.
@@ -77,6 +87,22 @@ Available values for `size`:
7787
| `8x32` | 8 | 32 GB |
7888
| `16x64` | 16 | 64 GB |
7989
| `32x128` | 32 | 128 GB |
90+
| `64x256` | 64 | 256 GB |
91+
92+
## Environment variable changes don't persist in custom images
93+
94+
For actions that set or change environment variables, you need to include the steps in both the image build workflow and the workflows that use the custom image.
95+
96+
Snapshots capture only the sandbox filesystem. Environment variables exist only in the running process (not the filesystem) so they aren't included in the snapshot.
97+
98+
For example, some actions (like `actions/setup-node`) download tools and configure `PATH` to find them. The downloaded tools persist in the snapshot, but the `PATH` changes don't. When a new job starts from the custom image, it's a fresh environment with default environment variables. The tools are present but can't be found without the `PATH` updates.
99+
100+
To restore the environment variables, include the action in both workflows:
101+
102+
- In the image build workflow, the action downloads the tool and bakes it into the filesystem.
103+
- In the workflow that uses the custom image, the action detects the tool is already on disk, skips the download, and only sets up the environment variables.
104+
105+
Steps that install tools with `apt-get install` don't need to be in both workflows because they install to system paths that are already on `PATH` by default.
80106

81107
## Full example
82108

@@ -128,3 +154,14 @@ jobs:
128154
```
129155

130156
Run `.depot/workflows/build-ci-image.yml` whenever dependencies change to keep the custom image up-to-date.
157+
158+
## Best practices
159+
160+
**Set `clean: false` when pre-cloning a repository**: If your custom image includes a pre-cloned copy of your repository, set `clean: false` on `actions/checkout` so it skips running `git clean -ffdx` before fetching. Without `clean: false`, checkout removes untracked files from the pre-cloned repo (like installed dependencies or build artifacts), negating the benefit of pre-cloning.
161+
162+
```yaml
163+
steps:
164+
- uses: actions/checkout@v4
165+
with:
166+
clean: false
167+
```

content/ci/how-to-guides/debug-with-ssh.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ ogTitle: How to debug a failing Depot CI job with SSH
44
description: Learn how to SSH into a Depot CI job to interactively debug failures and inspect the job environment.
55
---
66

7-
To debug a failing step in Depot CI, you can connect to the sandbox running your job using SSH. There are two ways to do this depending on what you need:
7+
Debug a Depot CI job using SSH to inspect the sandbox running the job.
88

9-
- **tmate-based SSH**: Inject a pause at a specific step number and automatically connect. Use this when you want to inspect the exact environment state right before a failing step, with the full workflow environment (checked-out code, installed dependencies, environment variables) available.
9+
## How it works
10+
11+
You can connect to the sandbox running your job using SSH. There are two ways to do this depending on what you need:
12+
13+
- **tmate-based SSH**: Inject a pause at a specific step number and automatically connect with the [tmate](https://github.com/mxschmitt/action-tmate) action. Use this when you want to inspect the exact environment state right before a failing step, with the full workflow environment (checked-out code, installed dependencies, environment variables) available.
1014
- **Direct SSH**: Connect directly to the Depot sandbox running your job. Use this when you want a live shell without needing to stop at a specific step. Note that direct SSH connects to the sandbox itself and does not include the workflow environment. Steps like `actions/checkout` or dependency installation might not have run yet, or might land in a different working directory.
1115

1216
## Prerequisites

content/ci/how-to-guides/manage-secrets-and-variables.mdx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@ ogTitle: How to manage secrets and variables in Depot CI
44
description: Learn how to add and remove secrets and environment variables for use in your Depot CI workflows.
55
---
66

7-
Secrets and variables in Depot CI are scoped to your Depot organization or to a single repository. Repository-scoped secrets override org-wide secrets with the same name.
7+
Secrets and variables in Depot CI are scoped to your Depot organization or to a single repository. Repository-scoped secrets override org-wide secrets with the same
8+
name.
89

9-
Organization owners can manage secrets and variables from the Depot CI [**Settings**](https://depot.dev/orgs/_/workflows/settings) in the Depot dashboard:
10+
Organization owners can manage secrets and variables from the Depot CI [**Settings**](https://depot.dev/orgs/_/workflows/settings) in the dashboard or from the CLI.
1011

1112
- Add org-wide or repo-specific secrets and variables.
12-
- View all org-wide secrets and variables, or filter by repo.
13+
- View all org-wide or repo-specific secrets and variables.
1314
- Remove secrets and variables.
1415

15-
You can't view secret values in the dashboard after you create them. Variable values are plain text and visible in the dashboard.
16+
You can't view secret values after you create them. Variable values are plain text and visible in the dashboard and CLI output.
1617

17-
Names must be non-empty. Repository-scoped names can't contain a forward slash (`/`).
18+
Names must be non-empty and repository-scoped names can't contain a forward slash (`/`).
1819

19-
### Import secrets and variables from GitHub
20+
## Import secrets and variables from GitHub
2021

2122
If you're migrating from GitHub Actions, you can import your existing GitHub secrets and variables into Depot CI with a single command:
2223

@@ -30,37 +31,39 @@ You can also manage secrets and variables with the Depot CLI. See the [examples]
3031

3132
## Add secrets to Depot CI using the dashboard
3233

33-
1. From the [Depot CI workflows](/orgs/_/workflows) page, click **Settings**.
34+
1. From the [Depot CI workflows](/orgs/_/workflows) page, click the settings icon.
3435
2. In the **Secrets** section, under **Set secret**, use the **Applies to** dropdown to choose the scope.
3536
3. Enter a **Name** and **Value** for the secret. Optionally add a **Description**.
3637
4. Click **Set secret**.
3738

3839
## Remove secrets in Depot CI using the dashboard
3940

40-
1. From the [Depot CI workflows](/orgs/_/workflows) page, click **Settings**.
41+
1. From the [Depot CI](/orgs/_/workflows) page, click the settings icon.
4142
2. In the **Secrets** section, find the secret you want to remove and click its actions menu.
4243
3. Select **Remove secret** and click **Remove** to confirm.
4344

4445
## Add variables to Depot CI using the dashboard
4546

46-
1. From the [Depot CI workflows](/orgs/_/workflows) page, click **Settings**.
47+
1. From the [Depot CI](/orgs/_/workflows) page, click the settings icon.
4748
2. In the **Variables** section, under **Set variable**, use the **Applies to** dropdown to choose the scope.
4849
3. Enter a **Name** and **Value** for the variable. Optionally add a **Description**.
4950
4. Click **Set variable**.
5051

5152
## Remove variables in Depot CI using the dashboard
5253

53-
1. From the [Depot CI workflows](/orgs/_/workflows) page, click **Settings**.
54+
1. From the [Depot CI](/orgs/_/workflows) page, click the settings icon.
5455
2. In the **Variables** section, find the variable you want to remove and click its actions menu.
5556
3. Select **Remove variable** and click **Remove** to confirm.
5657

5758
## Update secrets and variables in Depot CI using the dashboard
5859

59-
You can update the description of a secret or variable from the dashboard. To update a secret or variable value, set it again with the same name. The new value overwrites the old one.
60+
You can update only the description of a secret or variable from the dashboard.
61+
62+
To update a secret or variable value, set it again with the same name. The new value overwrites the old one.
6063

6164
To update a description:
6265

63-
1. From the [Depot CI workflows](/orgs/_/workflows) page, click **Settings**.
66+
1. From the [Depot CI](/orgs/_/workflows) page, click the settings icon.
6467
2. Find the secret or variable and click its actions menu.
6568
3. Select **Edit description**.
6669
4. Update the description and click **Save**.

0 commit comments

Comments
 (0)