Skip to content

Support workflow run to be able to auto-review PRs from forks#116

Merged
derekmisler merged 3 commits intodocker:mainfrom
lorenrh:suppor-workflow-run
Mar 26, 2026
Merged

Support workflow run to be able to auto-review PRs from forks#116
derekmisler merged 3 commits intodocker:mainfrom
lorenrh:suppor-workflow-run

Conversation

@lorenrh
Copy link
Copy Markdown
Member

@lorenrh lorenrh commented Mar 26, 2026

Related Issues

Summary

The auto-review job previously only triggered for same-repo PRs because fork PRs don't have access to secrets in the pull_request event context. This PR adds a two-stage handoff to enable auto-review for fork contributors who are org members.

How it works:

  1. A new PR Review Trigger workflow runs on pull_request in the fork's context (no secrets needed). For fork PRs only, it saves the PR number as an artifact and completes.

  2. Self PR Review (and the reusable review-pr.yml) listen for workflow_run completion. They download the artifact to recover the PR number, then run the full org membership check and review with secrets from the base repo
    context.

Changes:

  • New pr-review-trigger.yml — lightweight trigger that saves PR metadata for fork PRs
  • self-review-pr.yml — adds workflow_run trigger, actions: read permission, and a get-pr step that downloads the artifact; updated auto-review job condition excludes same-repo workflow_run events to avoid spurious runs
  • review-pr.yml — adds workflow_run support to the reusable workflow's auto-review job; PR number resolved once in a dedicated get-pr step and threaded through via step outputs; ${{ }} expressions moved to env: in run: steps to prevent script injection

Tip

Comment /review to trigger the PR Reviewer agent for automated feedback.
Comment /describe to generate a PR description.

lorenrh added 2 commits March 26, 2026 10:19
Signed-off-by: Lorena Rangel <lorena.rangel@docker.com>
Signed-off-by: Lorena Rangel <lorena.rangel@docker.com>
@lorenrh lorenrh requested a review from a team as a code owner March 26, 2026 09:26
@lorenrh lorenrh changed the title Suppor workflow run Support workflow run to be able to auto-review PRs from forks Mar 26, 2026
@lorenrh
Copy link
Copy Markdown
Member Author

lorenrh commented Mar 26, 2026

/review

Copy link
Copy Markdown
Contributor

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

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

Assessment: 🟡 NEEDS ATTENTION

Found 3 issues in the workflow_run implementation that should be addressed for robustness and defense-in-depth.

Signed-off-by: Lorena Rangel <lorena.rangel@docker.com>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This workflow is only for this cagent-action repo, btw.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, but thought it would benefit from reviewing in forks (and make sure it works on it's own repo);

@derekmisler derekmisler merged commit bbf2b66 into docker:main Mar 26, 2026
32 checks passed
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