-
Notifications
You must be signed in to change notification settings - Fork 2.1k
gha: Add docker cagent PR reviewer workflows #7014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: PR Review - Trigger | ||
| on: | ||
| pull_request: | ||
| types: [ready_for_review, opened, review_requested] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| save-context: | ||
| if: > | ||
| 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, '<!-- 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 }} | ||
| 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_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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: PR Review | ||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
| workflow_run: | ||
| workflows: ["PR Review - Trigger"] | ||
| types: [completed] | ||
Check failureCode scanning / zizmor use of fundamentally insecure workflow trigger: workflow_run is almost always used insecurely Error
use of fundamentally insecure workflow trigger: workflow_run is almost always used insecurely
|
||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| review: | ||
| if: | | ||
| (github.event_name == 'issue_comment' && | ||
| 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, '<!-- cagent-review -->') && | ||
| !contains(github.event.comment.body, '<!-- cagent-review-reply -->')) || | ||
| github.event.workflow_run.conclusion == 'success' | ||
| uses: docker/cagent-action/.github/workflows/review-pr.yml@3f5dc9969f307d3c76acb7e9ccaefdd96bd62f4b # v1.5.4 | ||
|
Comment on lines
+13
to
+22
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes me wonder if these kind of conditions could be handled by the action itself, but I guess that's a chicken and egg case (action would always run, but then to find it didn't have to run) 🤔
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are, you don't need to include them.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know why the readme says they're necessary again, I've removed them before
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah! So they can all be removed, or still some that should be ? FWIW; I was wondering if we wanted to advertise this action for our users, and to add a section in our docs? I know we have a section on our other actions (so was searching if we did for this one as well) https://docs.docker.com/build/ci/github-actions/
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not yet, the plan is to move most of it into the agentic platform, then slim this down into something less complex for users |
||
| permissions: | ||
| contents: read # Read repository files and PR diffs | ||
| pull-requests: write # Post review comments | ||
| issues: write # Create security incident issues if secrets detected | ||
| checks: write # (Optional) Show review progress as a check run | ||
| id-token: write # Required for OIDC authentication to AWS Secrets Manager | ||
| actions: read # Download artifacts from trigger workflow | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. only necessary on private repo but doesn't hurt to keep it |
||
| with: | ||
| trigger-run-id: ${{ github.event_name == 'workflow_run' && format('{0}', github.event.workflow_run.id) || '' }} | ||
Uh oh!
There was an error while loading. Please reload this page.