Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pr_limit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

# Limits the number of concurrently open pull requests a contributor
# without write access can have. This mirrors GitHub's native
# without repository access can have. This mirrors GitHub's native
# "pull request creation cap" setting, which requires admin rights and
# so can only be configured for ASF repositories via .asf.yaml. Once
# https://github.com/apache/infrastructure-asfyaml/pull/111 is merged,
Expand All @@ -40,7 +40,7 @@ permissions:
pull-requests: write
issues: write
env:
# Maximum number of open pull requests per contributor without write
# Maximum number of open pull requests per contributor without repository
# access. A pull request that takes the contributor over this limit is
# closed with an explanatory comment.
PR_LIMIT: 3
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/pr_limit/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

const fs = require("fs");

const WRITE_PERMISSIONS = new Set(["write", "maintain", "admin"]);
const HAS_ACCESS = new Set(["triage", "write", "maintain", "admin"]);

/**
* Returns whether the user has write access to the repository.
* Returns whether the user has repository access.
*
* Note that `author_association` is not a reliable signal for this:
* ASF members show up as MEMBER regardless of their permission on this
Expand All @@ -30,14 +30,14 @@ const WRITE_PERMISSIONS = new Set(["write", "maintain", "admin"]);
* @param {Object} context
* @param {String} username
*/
async function hasWriteAccess(github, context, username) {
async function hasAccess(github, context, username) {
try {
const {data} = await github.rest.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner,
repo: context.repo.repo,
username: username
});
return WRITE_PERMISSIONS.has(data.permission);
return HAS_ACCESS.has(data.role_name);
} catch (error) {
if (error.status === 404) {
return false;
Expand Down Expand Up @@ -106,16 +106,16 @@ module.exports = async ({github, context, core}) => {
return;
}

if (await hasWriteAccess(github, context, user.login)) {
core.info(`Skipping: ${user.login} has write access.`);
if (await hasAccess(github, context, user.login)) {
core.info(`Skipping: ${user.login} has repository access.`);
return;
}

// A committer reopening a previously closed pull request is a deliberate
// decision to accept it, so don't close it again.
// A user with repository access reopening a previously closed pull request
// is a deliberate decision to accept it, so don't close it again.
const sender = context.payload.sender;
if (sender.login !== user.login && await hasWriteAccess(github, context, sender.login)) {
core.info(`Skipping: ${context.payload.action} by ${sender.login}, who has write access.`);
if (sender.login !== user.login && await hasAccess(github, context, sender.login)) {
core.info(`Skipping: ${context.payload.action} by ${sender.login}, who has repository access.`);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_limit/comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Thanks for opening a pull request!

**This pull request has been automatically closed because you currently have ${OPEN_COUNT} open pull requests, which is more than the limit of ${PR_LIMIT}.**

Due to the increase in pull requests opened by AI bots, and in order to keep the review queue manageable, Apache Arrow limits contributors without write access to at most ${PR_LIMIT} concurrently open pull requests. This helps make sure each pull request gets the attention it needs and that work in progress does not go stale.
Due to the increase in pull requests opened by AI bots, and in order to keep the review queue manageable, Apache Arrow limits contributors without repository access to at most ${PR_LIMIT} concurrently open pull requests. This helps make sure each pull request gets the attention it needs and that work in progress does not go stale.

Once one of [your other open pull requests](https://github.com/apache/arrow/pulls/${USERNAME}) has been merged or closed, you are welcome to reopen this one.

Expand Down
3 changes: 2 additions & 1 deletion docs/source/developers/bug_reports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,9 @@ Limit on concurrent pull requests
+++++++++++++++++++++++++++++++++

Due to the increase in pull requests opened by AI bots, and in order to keep
the review queue manageable, contributors without write access to the
the review queue manageable, contributors without the required access to the
repository may have at most **3 pull requests open at the same time**.
The required access is either write access (committers) or triage (collaborators).
A pull request opened beyond that limit is automatically closed by a GitHub
Actions workflow, with a comment explaining why. Once one of your other pull
requests has been merged or closed, you can reopen it.
Expand Down
Loading