Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 1, 2025

Enforces that all PRs have at least one approved review from a valid peer before merging. Excludes reviews from the PR author, DonnieBLT, coderabbit, and copilot.

Exempts PRs created by DonnieBLT, dependabot, and copilot users from the check entirely.

Implementation

New workflow: .github/workflows/check-peer-review.yml

  • Triggers on PR events (opened, synchronize, reopened) and review events (submitted, dismissed)
  • Skips workflow execution for PRs created by: DonnieBLT, dependabot[bot], dependabot-preview[bot], dependabot, Copilot, copilot-swe-agent[bot]
  • Fetches reviews via GitHub API, filters for APPROVED state only
  • Excludes reviews from PR author, DonnieBLT, coderabbit[bot], and any username containing "copilot"
  • Posts one-time comment requesting peer review when check fails (uses HTML marker to prevent duplicates)
  • Validates HTTP 201 status for comment posting
  • Auto-passes when valid approval exists, fails otherwise

Behavior

# Workflow skips entirely for exempt users (DonnieBLT, dependabot, copilot)

# Check fails → Posts comment once
👋 Hi @author!
This pull request needs a peer review before it can be merged.
Please request a review from a team member who is not:
- The PR author
- DonnieBLT
- coderabbit
- copilot

# Valid peer approves → Check passes automatically

The jq filter explicitly validates review state and excluded users:

jq -r --arg author "$PR_AUTHOR" \
  '.[] | 
  select(.state == "APPROVED") | 
  select(.user.login != $author) | 
  select(.user.login != "DonnieBLT") | 
  select(.user.login != "coderabbit[bot]") | 
  select(.user.login | contains("copilot") | not) | 
  .user.login'
Original prompt

add a new github action check to pull requests that tests there is a peer review - someone that is not the author or DonnieBLT or coderabbit or copilot - show a comment to the author and have them request a peer review then make another change so the github action passes the next time


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 1, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Add GitHub Action to enforce peer review on pull requests Add GitHub Action to enforce peer review on pull requests Nov 1, 2025
Copilot AI requested a review from DonnieBLT November 1, 2025 18:00
@DonnieBLT DonnieBLT marked this pull request as ready for review November 1, 2025 19:45
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

👋 Hi @Copilot!

This pull request needs a peer review before it can be merged. Please request a review from a team member who is not:

  • The PR author
  • DonnieBLT
  • coderabbit
  • copilot

Once a valid peer review is submitted, this check will pass automatically. Thank you!

@DonnieBLT
Copy link
Collaborator

@copilot make DonnieBLT, dependabot and copilot be exempt from this github action

Copy link
Contributor Author

Copilot AI commented Nov 15, 2025

@copilot make DonnieBLT, dependabot and copilot be exempt from this github action

Done! Added exemption for DonnieBLT, dependabot, and copilot users. The peer review check will now skip entirely for PRs created by these users. (commit 524bc8b)

@DonnieBLT DonnieBLT merged commit 3b9f5bf into main Nov 16, 2025
1 check passed
@DonnieBLT DonnieBLT deleted the copilot/add-peer-review-check-action branch November 16, 2025 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants