[404]: /docker-hub/domain-audit #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Agent | |
| on: | |
| issues: | |
| types: [labeled] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| run-agent: | |
| # Only run when the "agent/fix" label is added | |
| if: github.event.label.name == 'agent/fix' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Create branch | |
| run: | | |
| git checkout -b agent/issue-${{ github.event.issue.number }} | |
| - name: Run agent | |
| uses: docker/[email protected] | |
| timeout-minutes: 15 | |
| with: | |
| cagent-version: v1.15.5 | |
| agent: ./agent.yml | |
| yolo: true | |
| prompt: | | |
| Work on GitHub issue: ${{ github.event.issue.html_url }} | |
| Fetch the issue, analyze what documentation changes are needed, and | |
| implement them following your standard workflow. | |
| If you identify any upstream coordination issues (broken links from | |
| vendored content, missing CLI flags, etc.), document them in | |
| .upstream-issues.md as specified in your instructions. | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if [[ -n $(git status --porcelain) ]]; then | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit changes | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: | | |
| 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" | |
| - name: Push changes | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: | | |
| git push -u origin agent/issue-${{ github.event.issue.number }} | |
| - name: Create pull request | |
| if: steps.changes.outputs.has_changes == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR_BODY: | | |
| ## Summary | |
| This PR addresses #${{ github.event.issue.number }}. | |
| ## Changes | |
| The documentation agent team analyzed the issue and implemented the requested changes. | |
| 🤖 Generated with [cagent](https://github.com/docker/cagent) | |
| Closes #${{ github.event.issue.number }} | |
| run: | | |
| # Add upstream coordination section if file exists | |
| if [[ -f .upstream-issues.md ]]; then | |
| UPSTREAM_SECTION=$(cat .upstream-issues.md) | |
| FULL_PR_BODY="${PR_BODY/Closes #/$UPSTREAM_SECTION\n\nCloses #}" | |
| else | |
| FULL_PR_BODY="$PR_BODY" | |
| fi | |
| gh pr create \ | |
| --title "docs: address issue #${{ github.event.issue.number }}" \ | |
| --body "$FULL_PR_BODY" \ | |
| --base main \ | |
| --head agent/issue-${{ github.event.issue.number }} | |
| - name: Comment on issue (success) | |
| if: steps.changes.outputs.has_changes == 'true' | |
| 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' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh issue comment ${{ github.event.issue.number }} --body "ℹ️ The agent team ran but didn't make any changes. This might indicate the issue needs clarification or is already resolved." | |
| - name: Comment on issue (failure) | |
| if: failure() | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh issue comment ${{ github.event.issue.number }} --body "❌ The agent team encountered an error. Please check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details." |