Skip to content

Commit e628c62

Browse files
committed
ci: improve agent/fix workflow
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent f7b2cc0 commit e628c62

File tree

2 files changed

+36
-46
lines changed

2 files changed

+36
-46
lines changed

.github/workflows/agent.yml

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,9 @@ jobs:
2121
- name: Set up Docker Buildx
2222
uses: docker/setup-buildx-action@v3
2323

24-
- name: Configure Git
25-
run: |
26-
git config user.name "github-actions[bot]"
27-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
28-
2924
- name: Install dependencies
3025
run: npm ci
3126

32-
- name: Create branch
33-
run: |
34-
git checkout -b agent/issue-${{ github.event.issue.number }}
35-
3627
- name: Run agent
3728
uses: docker/cagent-action@v1.0.3
3829
timeout-minutes: 15
@@ -44,27 +35,50 @@ jobs:
4435
Work on GitHub issue: ${{ github.event.issue.html_url }}
4536
4637
Fetch the issue, analyze what documentation changes are needed, and
47-
implement them following your standard workflow.
38+
implement them.
39+
40+
When complete, write .pr-body.md following this structure:
4841
49-
If you identify any upstream coordination issues (broken links from
50-
vendored content, missing CLI flags, etc.), document them in
51-
.upstream-issues.md as specified in your instructions.
42+
## Summary
43+
One sentence describing what was fixed/added/changed.
44+
45+
## Changes
46+
Bulleted list of specific changes (be concise, focus on what matters).
47+
48+
## Upstream coordination needed
49+
Only include this section if there are issues requiring fixes in upstream
50+
repos (docker/cli, moby/moby, etc.). Otherwise omit it entirely.
51+
52+
Fixes #${{ github.event.issue.number }}
53+
54+
---
55+
🤖 Generated with [cagent](https://github.com/docker/cagent)
56+
57+
Keep the PR body brief and practical. Don't over-explain or add sections
58+
that aren't needed.
5259
env:
5360
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
5461
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5562

5663
- name: Check for changes
5764
id: changes
5865
run: |
59-
if [[ -n $(git status --porcelain) ]]; then
60-
echo "has_changes=true" >> $GITHUB_OUTPUT
61-
else
66+
if git diff --quiet; then
6267
echo "has_changes=false" >> $GITHUB_OUTPUT
68+
else
69+
echo "has_changes=true" >> $GITHUB_OUTPUT
6370
fi
6471
65-
- name: Commit changes
72+
- name: Commit and push
6673
if: steps.changes.outputs.has_changes == 'true'
74+
env:
75+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6776
run: |
77+
git config user.name "github-actions[bot]"
78+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
79+
80+
BRANCH="agent/issue-${{ github.event.issue.number }}"
81+
git checkout -b "$BRANCH"
6882
git add .
6983
git commit -m "docs: address issue #${{ github.event.issue.number }}
7084
@@ -73,41 +87,17 @@ jobs:
7387
7488
🤖 Generated with cagent"
7589
76-
- name: Push changes
77-
if: steps.changes.outputs.has_changes == 'true'
78-
run: |
79-
git push -u origin agent/issue-${{ github.event.issue.number }}
90+
git push origin "$BRANCH"
8091
8192
- name: Create pull request
8293
if: steps.changes.outputs.has_changes == 'true'
8394
env:
84-
GH_TOKEN: ${{ github.token }}
85-
PR_BODY: |
86-
## Summary
87-
88-
This PR addresses #${{ github.event.issue.number }}.
89-
90-
## Changes
91-
92-
The documentation agent team analyzed the issue and implemented the requested changes.
93-
94-
🤖 Generated with [cagent](https://github.com/docker/cagent)
95-
96-
Closes #${{ github.event.issue.number }}
95+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9796
run: |
98-
# Add upstream coordination section if file exists
99-
if [[ -f .upstream-issues.md ]]; then
100-
UPSTREAM_SECTION=$(cat .upstream-issues.md)
101-
FULL_PR_BODY="${PR_BODY/Closes #/$UPSTREAM_SECTION\n\nCloses #}"
102-
else
103-
FULL_PR_BODY="$PR_BODY"
104-
fi
105-
10697
gh pr create \
10798
--title "docs: address issue #${{ github.event.issue.number }}" \
108-
--body "$FULL_PR_BODY" \
109-
--base main \
110-
--head agent/issue-${{ github.event.issue.number }}
99+
--body-file .pr-body.md \
100+
--label agent/generated
111101
112102
- name: Comment on issue (success)
113103
if: steps.changes.outputs.has_changes == 'true'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ tmp
1414
cagent
1515
# cagent tmp files
1616
.cagent
17-
.upstream-issues.md
17+
.pr-body.md
1818
.validation.log

0 commit comments

Comments
 (0)