Skip to content

update cagent-action to latest (with better permissions)#13665

Open
derekmisler wants to merge 3 commits intodocker:mainfrom
derekmisler:update-cagent-action-to-latest-with-better-permis
Open

update cagent-action to latest (with better permissions)#13665
derekmisler wants to merge 3 commits intodocker:mainfrom
derekmisler:update-cagent-action-to-latest-with-better-permis

Conversation

@derekmisler
Copy link

@derekmisler derekmisler commented Mar 24, 2026

What I did

Upgrade docker/cagent-action from v1.2.13 to v1.3.1 and simplify the PR review workflow.

Key changes:

  • Bump cagent-action ref to dba0ca51…@v1.3.1, which handles filtering logic (draft PRs, bot actors, collaborator checks) internally — removing ~20 lines of hand-rolled if conditions from the workflow.
  • Switch trigger from pull_request_target to pull_request — the new action version manages fork PR security itself, so pull_request_target is no longer needed. Fork PRs can still be reviewed via the /review comment command.
  • Add top-level permissions: contents: read so issue_comment-triggered runs can access secrets, and scope remaining permissions to the review job to follow least-privilege.
  • Remove concurrency block — the updated action handles review serialization internally.
  • Add inline comments on secrets and triggers for easier onboarding.

Related issue

Closes: https://github.com/docker/gordon/issues/272

(not mandatory) A picture of a cute animal, if possible in relation to what you did

🤖🐙 (an AI octopus reviewing pull requests)

Comment on lines -11 to -15
# Serialize reviews per PR; do not cancel in-progress runs
# so no review is silently dropped mid-execution.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number }}
cancel-in-progress: false
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already baked into the action.

Comment on lines -19 to -33
# Only run on the upstream repo (not forks) to prevent credential leaks.
# Skip draft PRs (ready_for_review will fire when promoted).
# Skip bot actors to avoid reviewing Dependabot and automation PRs.
# Require collaborator-level access for comment-triggered events.
# Only trigger on PR comments, not plain issue comments.
if: >-
github.repository == 'docker/compose' &&
(github.event_name != 'pull_request_target' || github.event.pull_request.draft == false) &&
(github.event_name == 'pull_request_target' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) ||
(github.event_name == 'pull_request_review_comment' &&
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association))) &&
!endsWith(github.actor, '[bot]')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also now included in the action.

Signed-off-by: Derek Misler <derek.misler@docker.com>
@derekmisler derekmisler force-pushed the update-cagent-action-to-latest-with-better-permis branch from 4417b26 to 4b44171 Compare March 24, 2026 19:32
@derekmisler derekmisler marked this pull request as ready for review March 24, 2026 19:32
@derekmisler derekmisler requested a review from a team as a code owner March 24, 2026 19:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the PR review automation workflow to use the latest docker/cagent-action reusable workflow and simplifies the workflow logic by relying on the action’s built-in filtering/serialization.

Changes:

  • Bump docker/cagent-action reusable workflow pin to v1.3.1.
  • Switch auto-review trigger from pull_request_target to pull_request, keeping /review via issue_comment.
  • Add top-level permissions: contents: read and scope job-level permissions explicitly; remove prior workflow-level if gating and concurrency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

derekmisler and others added 2 commits March 24, 2026 15:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Derek Misler <derekmisler@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Derek Misler <derekmisler@gmail.com>
@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants