Skip to content

Commit 6db352f

Browse files
committed
ci: use create-pull-request in writer agent workflow
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent d945190 commit 6db352f

1 file changed

Lines changed: 16 additions & 38 deletions

File tree

.github/workflows/agent-writer.yml

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -67,54 +67,32 @@ jobs:
6767
env:
6868
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6969

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

10987
- name: Comment on issue (success)
110-
if: steps.changes.outputs.has_changes == 'true'
88+
if: steps.create-pr.outputs.pull-request-number
11189
env:
11290
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11391
run: |
11492
gh issue comment ${{ github.event.issue.number }} --body "✅ The agent team has created a PR to address this issue. Please review when ready."
11593
11694
- name: Comment on issue (no changes)
117-
if: steps.changes.outputs.has_changes == 'false'
95+
if: "!steps.create-pr.outputs.pull-request-number"
11896
env:
11997
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12098
run: |

0 commit comments

Comments
 (0)