Skip to content

Commit 4ed0e4e

Browse files
authored
Merge pull request #7014 from vvoland/work-gha
gha: Add docker cagent PR reviewer workflows
2 parents 90f2f30 + a1cf501 commit 4ed0e4e

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: PR Review - Trigger
2+
on:
3+
pull_request:
4+
types: [ready_for_review, opened, review_requested]
5+
pull_request_review_comment:
6+
types: [created]
7+
8+
permissions: {}
9+
10+
jobs:
11+
save-context:
12+
if: >
13+
github.event.comment.user.login != 'docker-agent' &&
14+
github.event.comment.user.login != 'docker-agent[bot]' &&
15+
github.event.comment.user.type != 'Bot' &&
16+
!contains(github.event.comment.body, '<!-- cagent-review -->') &&
17+
!contains(github.event.comment.body, '<!-- cagent-review-reply -->')
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Save event context
21+
env:
22+
PR_NUMBER: ${{ github.event.pull_request.number }}
23+
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
24+
COMMENT_JSON: ${{ toJSON(github.event.comment) }}
25+
run: |
26+
mkdir -p context
27+
printf '%s' "${{ github.event_name }}" > context/event_name.txt
28+
printf '%s' "$PR_NUMBER" > context/pr_number.txt
29+
printf '%s' "$PR_HEAD_SHA" > context/pr_head_sha.txt
30+
if [ "${{ github.event_name }}" = "pull_request_review_comment" ]; then
31+
printf '%s' "$COMMENT_JSON" > context/comment.json
32+
fi
33+
34+
- name: Upload context
35+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
36+
with:
37+
name: pr-review-context
38+
path: context/
39+
retention-days: 1

.github/workflows/pr-review.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: PR Review
2+
on:
3+
issue_comment:
4+
types: [created]
5+
workflow_run:
6+
workflows: ["PR Review - Trigger"]
7+
types: [completed]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
review:
14+
if: |
15+
(github.event_name == 'issue_comment' &&
16+
github.event.comment.user.login != 'docker-agent' &&
17+
github.event.comment.user.login != 'docker-agent[bot]' &&
18+
github.event.comment.user.type != 'Bot' &&
19+
!contains(github.event.comment.body, '<!-- cagent-review -->') &&
20+
!contains(github.event.comment.body, '<!-- cagent-review-reply -->')) ||
21+
github.event.workflow_run.conclusion == 'success'
22+
uses: docker/cagent-action/.github/workflows/review-pr.yml@3f5dc9969f307d3c76acb7e9ccaefdd96bd62f4b # v1.5.4
23+
permissions:
24+
contents: read # Read repository files and PR diffs
25+
pull-requests: write # Post review comments
26+
issues: write # Create security incident issues if secrets detected
27+
checks: write # (Optional) Show review progress as a check run
28+
id-token: write # Required for OIDC authentication to AWS Secrets Manager
29+
actions: read # Download artifacts from trigger workflow
30+
with:
31+
trigger-run-id: ${{ github.event_name == 'workflow_run' && format('{0}', github.event.workflow_run.id) || '' }}

0 commit comments

Comments
 (0)