-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Implement PR quota workflow #7882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Yuri Shkuro <github@ysh.us>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a PR quota management system that limits concurrent open pull requests from new contributors based on their merge history. The system automatically applies labels and posts comments to PRs that exceed quota limits, and removes restrictions when quota becomes available.
Changes:
- Added GitHub Actions workflow that triggers on PR events (opened, closed, reopened) and manual dispatch
- Implemented core quota logic with tiered limits (1 PR for 0 merges, 2 for 1 merge, 3 for 2 merges, unlimited for 3+)
- Created comprehensive test suite covering quota calculation, PR fetching, label management, and comment posting
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/pr-quota-manager.yml | GitHub Actions workflow configuration for automated quota management |
| .github/scripts/pr-quota-manager.js | Core implementation of quota calculation, PR processing, and GitHub API interactions |
| .github/scripts/pr-quota-manager.test.js | Unit tests for all quota management functions |
| .github/scripts/package.json | Node.js package configuration with dependencies and test scripts |
| .github/scripts/list-open-prs-by-author.js | Utility script for listing and analyzing open PRs by author |
| .github/scripts/README.md | Documentation for manual execution and troubleshooting |
| .github/scripts/.gitignore | Git ignore configuration for node_modules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const handler = require('./.github/scripts/pr-quota-manager.js') | ||
| const username = context.payload.pull_request?.user?.login || context.payload.inputs?.username | ||
| const owner = context.repo.owner | ||
| const repo = context.repo.repo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub Actions workflow_dispatch boolean inputs are passed as strings, not booleans. When dryRun is set to false via the UI, context.payload.inputs.dryRun will be the string "false", which is truthy in JavaScript. This causes dry-run mode to always be enabled when manually triggered.
Fix:
const dryRun = context.payload.inputs?.dryRun === true || context.payload.inputs?.dryRun === 'true'| const repo = context.repo.repo | |
| const dryRun = context.payload.inputs?.dryRun === true || context.payload.inputs?.dryRun === 'true' |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7882 +/- ##
==========================================
+ Coverage 95.51% 95.52% +0.01%
==========================================
Files 305 305
Lines 16212 16212
==========================================
+ Hits 15485 15487 +2
+ Misses 569 568 -1
+ Partials 158 157 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Metrics Comparison SummaryTotal changes across all snapshots: 0 Detailed changes per snapshotsummary_metrics_snapshot_cassandra📊 Metrics Diff SummaryTotal Changes: 0
summary_metrics_snapshot_cassandra📊 Metrics Diff SummaryTotal Changes: 0
summary_metrics_snapshot_cassandra📊 Metrics Diff SummaryTotal Changes: 0
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
.github/scripts/README.md:1
- Extra space between '=' and .repeat(80) should be removed.
# PR Quota Manager - Manual Execution Guide
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
.github/scripts/README.md:1
- Corrected spacing in 'repeat(80)' - there should be no space before 'repeat'.
# PR Quota Manager - Manual Execution Guide
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
## Which problem is this PR solving? - Resolves jaegertracing#7881 --------- Signed-off-by: Yuri Shkuro <github@ysh.us> Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Which problem is this PR solving?