mirror of
https://github.com/docker/docs.git
synced 2026-03-27 06:18:55 +07:00
Merge pull request #24199 from dvdksn/fix-agent-writer-workflow
fix agent writer workflow
This commit is contained in:
59
.github/workflows/agent-writer.yml
vendored
59
.github/workflows/agent-writer.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Agent
|
||||
name: Agent writer
|
||||
|
||||
on:
|
||||
issues:
|
||||
@@ -28,7 +28,6 @@ jobs:
|
||||
uses: docker/cagent-action@latest
|
||||
timeout-minutes: 15
|
||||
with:
|
||||
cagent-version: v1.22.0
|
||||
agent: ./tech_writer.yml
|
||||
yolo: true
|
||||
prompt: |
|
||||
@@ -68,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: |
|
||||
|
||||
Reference in New Issue
Block a user