fix: handle stdin EPIPE when agent exits before reading prompt #148
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
| # Copyright The Docker Agent Action authors | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Self PR Review - Trigger | |
| on: | |
| pull_request: | |
| types: [review_requested] | |
| pull_request_review_comment: | |
| types: [ created ] | |
| # Rate-anomaly safeguard: collapse a burst of review_requested events on the same | |
| # PR at the source — re-requesting a review is redundant, so cancel-in-progress | |
| # drops superseded context-capture runs and only the latest fans out to a review. | |
| # The group is also keyed by the requested reviewer so a request for someone else | |
| # (whose run only skips below) never cancels an in-flight docker-agent capture. | |
| # Distinct review comments stay independent (the comment id keys them into their | |
| # own group) so a real reply is never dropped by another comment on the same PR. | |
| concurrency: | |
| group: pr-review-trigger-${{ github.event.pull_request.number || github.run_id }}-${{ github.event.comment.id || github.event.requested_reviewer.login || 'review-request' }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| save-context: | |
| # Only a review request for docker-agent may fan out to a review — a request | |
| # for a human or team reviewer must not cost an LLM run (see SECURITY.md, | |
| # "Review-Request Abuse Safeguards"). The comment filters drop bot events. | |
| if: > | |
| (github.event_name != 'pull_request' || | |
| github.event.action != 'review_requested' || | |
| github.event.requested_reviewer.login == 'docker-agent') && | |
| github.event.comment.user.login != 'docker-agent' && | |
| github.event.comment.user.login != 'docker-agent[bot]' && | |
| github.event.comment.user.type != 'Bot' && | |
| !contains(github.event.comment.body, '<!-- docker-agent-review -->') && | |
| !contains(github.event.comment.body, '<!-- docker-agent-review-reply -->') && | |
| !contains(github.event.comment.body, '<!-- cagent-review -->') && | |
| !contains(github.event.comment.body, '<!-- cagent-review-reply -->') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Save event context | |
| env: | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| REQUESTED_REVIEWER: ${{ github.event.requested_reviewer.login }} | |
| COMMENT_JSON: ${{ toJSON(github.event.comment) }} | |
| run: | | |
| mkdir -p context | |
| printf '%s' "${{ github.event_name }}" > context/event_name.txt | |
| printf '%s' "$PR_NUMBER" > context/pr_number.txt | |
| printf '%s' "$PR_HEAD_SHA" > context/pr_head_sha.txt | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| printf '%s' "$REQUESTED_REVIEWER" > context/requested_reviewer.txt | |
| fi | |
| if [ "${{ github.event_name }}" = "pull_request_review_comment" ]; then | |
| printf '%s' "$COMMENT_JSON" > context/comment.json | |
| fi | |
| - name: Upload context | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: pr-review-context | |
| path: context/ | |
| retention-days: 1 |