forked from docker/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (97 loc) · 4.03 KB
/
agent.yml
File metadata and controls
121 lines (97 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Agent
on:
issues:
types: [labeled]
permissions:
contents: write
pull-requests: write
issues: write
jobs:
run-agent:
# Only run when the "agent/fix" label is added
if: github.event.label.name == 'agent/fix'
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install dependencies
run: npm ci
- name: Run agent
uses: docker/cagent-action@v1.0.5
timeout-minutes: 15
with:
cagent-version: v1.15.5
agent: ./agent.yml
yolo: true
prompt: |
Work on GitHub issue: ${{ github.event.issue.html_url }}
Fetch the issue, analyze what documentation changes are needed, and
implement them.
When complete, write .pr-body.md following this structure:
## Summary
One sentence describing what was fixed/added/changed.
## Changes
Bulleted list of specific changes (be concise, focus on what matters).
## Upstream coordination needed
Only include this section if there are issues requiring fixes in upstream
repos (docker/cli, moby/moby, etc.). Otherwise omit it entirely.
Fixes #${{ github.event.issue.number }}
---
🤖 Generated with [cagent](https://github.com/docker/cagent)
Keep the PR body brief and practical. Don't over-explain or add sections
that aren't needed.
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for changes
id: changes
run: |
if git diff --quiet; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push
if: steps.changes.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
BRANCH="agent/issue-${{ github.event.issue.number }}"
git checkout -b "$BRANCH"
git add .
git commit -m "docs: address issue #${{ github.event.issue.number }}
This change was automatically generated by the documentation agent team
in response to issue #${{ github.event.issue.number }}.
🤖 Generated with cagent"
git push origin "$BRANCH"
- name: Create pull request
if: steps.changes.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--title "docs: address issue #${{ github.event.issue.number }}" \
--body-file .pr-body.md \
--label agent/generated
- name: Comment on issue (success)
if: steps.changes.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue comment ${{ github.event.issue.number }} --body "✅ The agent team has created a PR to address this issue. Please review when ready."
- name: Comment on issue (no changes)
if: steps.changes.outputs.has_changes == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue comment ${{ github.event.issue.number }} --body "ℹ️ The agent team ran but didn't make any changes. This might indicate the issue needs clarification or is already resolved."
- name: Comment on issue (failure)
if: failure()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue comment ${{ github.event.issue.number }} --body "❌ The agent team encountered an error. Please check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details."