ci: use create-pull-request in writer agent workflow

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson
2026-02-23 16:23:29 +01:00
parent d94519016d
commit 6db352ff48
+17 -39
View File
@@ -67,54 +67,32 @@ jobs:
env:
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
id: create-pr
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
with:
branch: agent/issue-${{ github.event.issue.number }}
title: "docs: address issue #${{ github.event.issue.number }}"
body-path: .pr-body.md
commit-message: |
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
labels: agent/generated
delete-branch: true
- name: Comment on issue (success)
if: steps.changes.outputs.has_changes == 'true'
if: steps.create-pr.outputs.pull-request-number
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'
if: "!steps.create-pr.outputs.pull-request-number"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |