Skip to content

Commit 1ec2d35

Browse files
bdougieclaude
andcommitted
docs: recommend reusable workflow for GitHub Actions
Replace inline workflow with Continue's reusable workflow which handles agent discovery, parallel execution, and check reporting. GH_TOKEN is now automatically provided for agents using the gh CLI. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7074a50 commit 1ec2d35

File tree

1 file changed

+28
-129
lines changed

1 file changed

+28
-129
lines changed

docs/guides/run-agents-locally.mdx

Lines changed: 28 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -220,158 +220,57 @@ Before enabling fully automated agents:
220220

221221
## GitHub Actions Integration
222222

223-
Automate agent execution on pull requests with this workflow.
223+
Continue provides a [reusable workflow](https://github.com/continuedev/continue/blob/main/.github/workflows/continue-agents.yml) that handles agent discovery, parallel execution, and GitHub Check reporting.
224224

225-
### Basic Workflow
225+
### Using the Reusable Workflow (Recommended)
226226

227-
Create `.github/workflows/continue-agents.yml`:
227+
Create `.github/workflows/run-agents.yml`:
228228

229229
```yaml
230-
name: Continue Agents
230+
name: Run Agents
231231
232232
on:
233233
pull_request:
234234
types: [opened, reopened, synchronize]
235235
branches:
236236
- main
237237
238-
permissions:
239-
contents: write
240-
checks: write
241-
pull-requests: write
238+
jobs:
239+
agents:
240+
uses: continuedev/continue/.github/workflows/continue-agents.yml@main
241+
secrets:
242+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
243+
```
244+
245+
The reusable workflow automatically:
246+
- Discovers all `.md` files in `.continue/agents/`
247+
- Runs each agent in parallel
248+
- Creates GitHub Check runs for each agent
249+
- Provides `GH_TOKEN` for agents using the `gh` CLI
250+
- Writes job summaries with agent output
242251

252+
### Configuration Options
253+
254+
```yaml
243255
jobs:
244-
discover:
245-
runs-on: ubuntu-latest
246-
outputs:
247-
matrix: ${{ steps.discover.outputs.matrix }}
248-
has-agents: ${{ steps.discover.outputs.has_agents }}
249-
steps:
250-
- uses: actions/checkout@v4
251-
252-
- name: Discover agents
253-
id: discover
254-
run: |
255-
AGENTS_DIR=".continue/agents"
256-
if [ -d "$AGENTS_DIR" ]; then
257-
FILES=$(find "$AGENTS_DIR" -name "*.md" -type f 2>/dev/null | jq -R . | jq -sc .)
258-
COUNT=$(echo "$FILES" | jq 'length')
259-
HAS_AGENTS=$([[ $COUNT -gt 0 ]] && echo "true" || echo "false")
260-
else
261-
FILES="[]"
262-
HAS_AGENTS="false"
263-
fi
264-
265-
echo "matrix=$FILES" >> $GITHUB_OUTPUT
266-
echo "has_agents=$HAS_AGENTS" >> $GITHUB_OUTPUT
267-
268-
run-agent:
269-
needs: discover
270-
if: needs.discover.outputs.has-agents == 'true'
271-
runs-on: ubuntu-latest
272-
strategy:
273-
fail-fast: false
274-
matrix:
275-
agent: ${{ fromJson(needs.discover.outputs.matrix) }}
276-
steps:
277-
- uses: actions/checkout@v4
278-
279-
- name: Setup Node.js
280-
uses: actions/setup-node@v4
281-
with:
282-
node-version: '20'
283-
284-
- name: Install Continue CLI
285-
run: npm i -g @continuedev/cli
286-
287-
- name: Extract agent name
288-
id: agent-name
289-
run: |
290-
AGENT_FILE="${{ matrix.agent }}"
291-
AGENT_NAME=$(basename "$AGENT_FILE" .md)
292-
echo "name=$AGENT_NAME" >> $GITHUB_OUTPUT
293-
294-
- name: Create Check Run
295-
id: check
296-
uses: actions/github-script@v7
297-
env:
298-
AGENT_NAME: ${{ steps.agent-name.outputs.name }}
299-
with:
300-
script: |
301-
const { data: check } = await github.rest.checks.create({
302-
owner: context.repo.owner,
303-
repo: context.repo.repo,
304-
name: `Continue: ${process.env.AGENT_NAME}`,
305-
head_sha: context.sha,
306-
status: 'in_progress',
307-
started_at: new Date().toISOString(),
308-
});
309-
core.setOutput('id', check.id);
310-
311-
- name: Run agent
312-
id: run
313-
env:
314-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
315-
GH_TOKEN: ${{ github.token }}
316-
run: |
317-
AGENT_FILE="${{ matrix.agent }}"
318-
319-
if OUTPUT=$(cn -p --agent "$AGENT_FILE" 2>&1); then
320-
echo "success=true" >> $GITHUB_OUTPUT
321-
echo "output<<EOF" >> $GITHUB_OUTPUT
322-
echo "$OUTPUT" >> $GITHUB_OUTPUT
323-
echo "EOF" >> $GITHUB_OUTPUT
324-
else
325-
echo "success=false" >> $GITHUB_OUTPUT
326-
echo "error<<EOF" >> $GITHUB_OUTPUT
327-
echo "$OUTPUT" >> $GITHUB_OUTPUT
328-
echo "EOF" >> $GITHUB_OUTPUT
329-
fi
330-
331-
- name: Update Check Run
332-
if: always()
333-
uses: actions/github-script@v7
334-
env:
335-
AGENT_OUTPUT: ${{ steps.run.outputs.output }}
336-
AGENT_ERROR: ${{ steps.run.outputs.error }}
337-
AGENT_SUCCESS: ${{ steps.run.outputs.success }}
338-
CHECK_RUN_ID: ${{ steps.check.outputs.id }}
339-
with:
340-
script: |
341-
const success = process.env.AGENT_SUCCESS === 'true';
342-
const output = process.env.AGENT_OUTPUT || '';
343-
const error = process.env.AGENT_ERROR || '';
344-
345-
await github.rest.checks.update({
346-
owner: context.repo.owner,
347-
repo: context.repo.repo,
348-
check_run_id: parseInt(process.env.CHECK_RUN_ID, 10),
349-
status: 'completed',
350-
conclusion: success ? 'success' : 'failure',
351-
completed_at: new Date().toISOString(),
352-
output: {
353-
title: success ? 'Agent completed' : 'Agent failed',
354-
summary: success
355-
? `Agent completed.\n\n\`\`\`\n${output.slice(0, 60000)}\n\`\`\``
356-
: `Agent failed.\n\n\`\`\`\n${error.slice(0, 60000)}\n\`\`\``,
357-
},
358-
});
359-
360-
- name: Fail if agent failed
361-
if: steps.run.outputs.success != 'true'
362-
run: exit 1
256+
agents:
257+
uses: continuedev/continue/.github/workflows/continue-agents.yml@main
258+
with:
259+
agents-path: '.continue/agents' # Custom agents directory (optional)
260+
secrets:
261+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
363262
```
364263

365264
### Required Secrets
366265

367-
Add these secrets to your repository under **Settings > Secrets and variables > Actions**:
266+
Add this secret to your repository under **Settings > Secrets and variables > Actions**:
368267

369268
| Secret | Description |
370269
|--------|-------------|
371270
| `ANTHROPIC_API_KEY` | Your Anthropic API key for Claude |
372271

373272
<Info>
374-
The `GH_TOKEN` is automatically provided by GitHub Actions via `${{ github.token }}`. This token is scoped to the repository and expires after the workflow completes.
273+
The reusable workflow automatically provides `GH_TOKEN` via `${{ github.token }}`, so agents using the `gh` CLI work out of the box.
375274
</Info>
376275

377276
## Environment Variables

0 commit comments

Comments
 (0)