Skip to content

Commit b5e217c

Browse files
authored
Merge pull request #24199 from dvdksn/fix-agent-writer-workflow
fix agent writer workflow
2 parents c66235c + 6db352f commit b5e217c

1 file changed

Lines changed: 17 additions & 40 deletions

File tree

.github/workflows/agent-writer.yml

Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Agent
1+
name: Agent writer
22

33
on:
44
issues:
@@ -28,7 +28,6 @@ jobs:
2828
uses: docker/cagent-action@latest
2929
timeout-minutes: 15
3030
with:
31-
cagent-version: v1.22.0
3231
agent: ./tech_writer.yml
3332
yolo: true
3433
prompt: |
@@ -68,54 +67,32 @@ jobs:
6867
env:
6968
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7069

71-
- name: Check for changes
72-
id: changes
73-
run: |
74-
if git diff --quiet; then
75-
echo "has_changes=false" >> $GITHUB_OUTPUT
76-
else
77-
echo "has_changes=true" >> $GITHUB_OUTPUT
78-
fi
79-
80-
- name: Commit and push
81-
if: steps.changes.outputs.has_changes == 'true'
82-
env:
83-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84-
run: |
85-
git config user.name "github-actions[bot]"
86-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
87-
88-
BRANCH="agent/issue-${{ github.event.issue.number }}"
89-
git checkout -b "$BRANCH"
90-
git add .
91-
git commit -m "docs: address issue #${{ github.event.issue.number }}
92-
93-
This change was automatically generated by the documentation agent team
94-
in response to issue #${{ github.event.issue.number }}.
95-
96-
🤖 Generated with cagent"
70+
- name: Create pull request
71+
id: create-pr
72+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
73+
with:
74+
branch: agent/issue-${{ github.event.issue.number }}
75+
title: "docs: address issue #${{ github.event.issue.number }}"
76+
body-path: .pr-body.md
77+
commit-message: |
78+
docs: address issue #${{ github.event.issue.number }}
9779
98-
git push origin "$BRANCH"
80+
This change was automatically generated by the documentation agent team
81+
in response to issue #${{ github.event.issue.number }}.
9982
100-
- name: Create pull request
101-
if: steps.changes.outputs.has_changes == 'true'
102-
env:
103-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104-
run: |
105-
gh pr create \
106-
--title "docs: address issue #${{ github.event.issue.number }}" \
107-
--body-file .pr-body.md \
108-
--label agent/generated
83+
🤖 Generated with cagent
84+
labels: agent/generated
85+
delete-branch: true
10986

11087
- name: Comment on issue (success)
111-
if: steps.changes.outputs.has_changes == 'true'
88+
if: steps.create-pr.outputs.pull-request-number
11289
env:
11390
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11491
run: |
11592
gh issue comment ${{ github.event.issue.number }} --body "✅ The agent team has created a PR to address this issue. Please review when ready."
11693
11794
- name: Comment on issue (no changes)
118-
if: steps.changes.outputs.has_changes == 'false'
95+
if: "!steps.create-pr.outputs.pull-request-number"
11996
env:
12097
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12198
run: |

0 commit comments

Comments
 (0)