Reusable GitHub workflow for strict, project-specific PR gating based on CODE_REVIEW.md.
It labels PRs with:
review:approvedreview:changes-requested
and publishes a required check-run (default: Review Agent Code Review).
- Consumer repo triggers
pull_request_target. - This reusable workflow reads
CODE_REVIEW.mdfrom the base branch. - It fetches PR diff metadata via GitHub API (no PR code execution).
- It runs your Review Agent/OpenCode command.
- It validates the JSON response outside the agent and applies deterministic pass/fail rules.
The reusable job runs on self-hosted runners.
- Add a
CODE_REVIEW.mdfile to the consumer repo (useCODE_REVIEW.template.mdin this repo). - Add
.github/workflows/review-agent.ymlto the consumer repo:
name: Review Agent Review
on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
review-agent:
uses: makerprism/code-review-workflow/.github/workflows/review-agent.yml@v1
permissions:
contents: read
checks: write
pull-requests: write
issues: write
packages: read
secrets: inherit
with:
code_review_path: CODE_REVIEW.md
workflow_ref: v1- Add required model secrets in the consumer repo or org secrets (for example
OPENAI_API_KEYand/orANTHROPIC_API_KEY). - Create labels in the consumer repo:
review:approvedreview:changes-requested
- In branch protection, require the check
Review Agent Code Review. - Ensure GitHub Actions is configured to allow reusable workflows from
makerprism/code-review-workflow.
By default the reusable workflow runs ./scripts/run-review-agent.sh from this repository.
You can override it with review_agent_command if needed.
review_agent_command must print one JSON object to stdout matching workflows/review-agent/review-result.schema.json.
The command receives these env vars:
REVIEW_AGENT_PROMPT_FILEREVIEW_AGENT_CONTEXT_FILEREVIEW_AGENT_OUTPUT_SCHEMA_FILE
Optional env vars for the default runner script:
REVIEW_AGENT_MODELREVIEW_AGENT_OPENCODE_EXTRA_ARGS
Use ### [ID] Title headings and key/value fields:
### [CR-001] Constraint title
- required: true
- applies_when: always
- pass_criteria: Your project-specific rule.
- evidence_required: What evidence must be cited.Only standards listed there are evaluated.
- Intended for
pull_request_target. - Fork PRs are blocked — the workflow skips on pull requests from forks to prevent token abuse.
- Do not execute PR head code.
- Review payload is built from GitHub API data and base-branch files.
- Keep permissions minimal.
code_review_path(defaultCODE_REVIEW.md)review_agent_command(default./scripts/run-review-agent.sh)check_name(defaultReview Agent Code Review)max_files(default120)max_patch_chars(default300000)fail_on_error(defaulttrue)allow_required_not_applicable(defaultfalse)workflow_ref(defaultmain)
Tag stable releases and reference @v1 from consumer repos.