Skip to content

ci: add pr-review-cycle workflow#49084

Open
dognose24 wants to merge 1 commit into
Automattic:trunkfrom
dognose24:upstream/pr-review-cycle-workflow
Open

ci: add pr-review-cycle workflow#49084
dognose24 wants to merge 1 commit into
Automattic:trunkfrom
dognose24:upstream/pr-review-cycle-workflow

Conversation

@dognose24
Copy link
Copy Markdown
Contributor

@dognose24 dognose24 commented May 22, 2026

Proposed changes

Adds .github/workflows/pr-review-cycle.yml — an event-driven workflow that runs one round of the post-PR-open review cycle per invocation.

What the workflow does (per round)

  1. Requests Copilot review on the PR (handles both Copilot and copilot-pull-request-reviewer[bot] reviewer naming).
  2. Tags @claude in a PR comment so the GitHub Claude app can pick it up if installed.
  3. Polls for new inline comments and check-run status; addresses actionable comments by editing the PR branch and pushing follow-up commits.
  4. Keeps the PR branch rebased on fresh trunk every round (not only on conflict) so CI signal stays current.
  5. Caps at 10 rounds with 10-minute sleeps between rounds (hard rules in the dispatched skill body — see PR #C in this batch).

Activation

  • workflow_dispatch (manual)
  • pull_request events: opened, ready_for_review, synchronize
  • Skips draft PRs and cross-repository (fork) PRs via job-condition gating.

Required secrets

  • ANTHROPIC_API_KEY — for the dispatched Claude Code session. The workflow no-ops gracefully if the secret is absent (so this PR is mergeable even before any secret is configured).

What this PR is / isn't

  • Is: a new opt-in CI workflow. Skipping draft / fork PRs by design.
  • Isn't: an automatic trigger on every existing PR. Repo defaults remain unchanged; the workflow only fires under the conditions above, and is no-op without the API-key secret.

A corresponding CODEOWNERS update on the fork (/tools/ai-sandbox/ @dognose24) is fork-specific and intentionally not included here.

Why parallel batch

This is one of 4 PRs upstreaming accumulated work from dognose24/jetpack:

The workflow dispatches to a skill defined in PR #C (/jetpack-pr-review-cycle). The workflow remains a no-op if that skill isn't present (the dispatch step exits with the missing-skill diagnostic), so this PR can ship before or after PR #C without breaking anything else.

Does this pull request change what data or activity we track or use?

No data collection. The workflow's actions are scoped to the PR it fires on: it reads PR / review state via the GitHub API, posts comments, and pushes branch commits. The ANTHROPIC_API_KEY secret (when configured) is used to call Anthropic's API from within the Claude Code session the workflow dispatches.

Testing instructions

  1. Verify the workflow is YAML-valid: yamllint .github/workflows/pr-review-cycle.yml.
  2. Confirm the activation gating — open a draft PR or a fork PR; the workflow should not run.
  3. With ANTHROPIC_API_KEY unset, the workflow's first step should fail gracefully (no-op, no API calls).
  4. With ANTHROPIC_API_KEY set in a fresh PR, the workflow should run one round, post the Copilot review request + @claude tag, then sleep 10 min before the next round.

🤖 Generated with Claude Code

Adds .github/workflows/pr-review-cycle.yml — an event-driven workflow
that runs one round of the post-PR-open review cycle per invocation.

The cycle:
1. Requests Copilot review on the PR (with fallback handling for
   `Copilot` vs `copilot-pull-request-reviewer[bot]` reviewer naming).
2. Tags @claude in a PR comment so the GitHub Claude app can pick it up.
3. Polls for new inline comments + check-run status; addresses
   actionable comments by editing and pushing follow-up commits.
4. Rebases the PR on fresh trunk every round (not only on conflict)
   to keep CI signal current.
5. Caps at 10 rounds with 10-minute sleeps between rounds (hard rules
   in the skill body it dispatches to).

Activation: triggered by `workflow_dispatch` and by `pull_request`
events (opened, ready_for_review, synchronize). Skips draft PRs and
cross-repository (fork) PRs per the gating in the job conditions.

Required repo secrets:
* ANTHROPIC_API_KEY — for the dispatched Claude Code session.
The workflow no-ops gracefully if the secret is absent.

This PR is one of a parallel batch upstreaming the dognose24/jetpack
fork's accumulated harness work. See "Related PRs" in PR body.

Note: a corresponding CODEOWNERS update on fork
(`/tools/ai-sandbox/ @dognose24`) is fork-specific and intentionally
not included here.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


@github-actions github-actions Bot added the OSS Citizen This Pull Request was opened by an Open Source contributor. label May 22, 2026
@dognose24 dognose24 self-assigned this May 22, 2026
Copy link
Copy Markdown
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

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

It seems like the whole point of this is to try to have AI code on a PR, but done inefficiently through GitHub Actions instead of running in a local Claude Code instance or the like. Why not just do that if you're wanting AI to write code for you?

Even if you really need Copilot to do reviews and you can't get that in any way other than by pushing to a PR, the local Claude Code instance could still wait for that and do things locally instead of running inside Actions.

- Branch: ${{ steps.ctx.outputs.branch }}
- Trigger: ${{ github.event_name }}

Follow the instructions in .claude/commands/jetpack-pr-review-cycle.md with these
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 file does not exist.

2. NEVER sleep. Complete one round and stop.
3. For all triggers: run one follow-up round —
snapshot → filter → address → CI → rebase → push → re-request review — then stop.
4. Read .claude/pr-review-state.json at the start of the round and write it at the end
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 is going to clutter the PR, and will be particularly annoying if the PR gets merged without deleting this garbage file.

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

Labels

Actions GitHub actions used to automate some of the work around releases and repository management OSS Citizen This Pull Request was opened by an Open Source contributor.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants