Skip to content

Commit a0cacf9

Browse files
committed
chore: team checks
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
1 parent 41cabce commit a0cacf9

4 files changed

Lines changed: 62 additions & 52 deletions

File tree

.github/scripts/lib/eligibility/has-eligibility-01-gfi.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* a Good First Issue (GFI) in this repository.
44
*
55
* ELIGIBILITY RULES:
6+
* - Repository team members (triage / write / maintain / admin)
7+
* are always eligible and bypass all checks.
68
* - Normal contributors may have up to `MAX_OPEN_ISSUES_NORMAL`
79
* open issue assignments.
810
* - Contributors listed in the spam list may have up to
@@ -16,16 +18,16 @@
1618
* - It does NOT post comments.
1719
* - Callers must invoke this before attempting assignment.
1820
*
19-
*
2021
* @param {Object} params
2122
* @param {import('@actions/github').GitHub} params.github - Authenticated GitHub client
2223
* @param {string} params.owner - Repository owner
2324
* @param {string} params.repo - Repository name
2425
* @param {string} params.username - GitHub username to check
2526
* @returns {Promise<boolean>} Whether the contributor may be assigned a GFI
2627
*/
27-
const { countOpenAssignedIssues } = require('..counts/count-open-assigned-issues');
28+
const { isTeam } = require('./is-team');
2829
const { isOnSpamList } = require('../counts/is-on-spam-list');
30+
const { countOpenAssignedIssues } = require('../counts/count-open-assigned-issues');
2931

3032
const MAX_OPEN_ISSUES_NORMAL = 2;
3133
const MAX_OPEN_ISSUES_SPAM_LIST = 1;
@@ -43,6 +45,14 @@ const hasGfiEligibility = async ({
4345
username,
4446
});
4547

48+
// Repository team members bypass all GFI eligibility checks.
49+
if (await isTeam({ github, owner, repo, username })) {
50+
console.log('[has-gfi-eligibility] Skipped: user is team member', {
51+
username,
52+
});
53+
return true;
54+
}
55+
4656
// Determine whether the contributor is listed in the spam list.
4757
// Spam-listed contributors are subject to stricter limits.
4858
const isSpamListed = await isOnSpamList({
@@ -74,11 +84,12 @@ const hasGfiEligibility = async ({
7484
maxAllowed,
7585
});
7686

77-
// If the contributor has reached or exceeded their allowed capacity,
78-
// they are not eligible for assignment.
87+
// Enforce assignment capacity limits
7988
if (openAssignedCount >= maxAllowed) {
8089
console.log('[has-gfi-eligibility] Exit: assignment limit reached', {
8190
username,
91+
openAssignedCount,
92+
maxAllowed,
8293
});
8394
return false;
8495
}

.github/scripts/lib/eligibility/has-eligibility-02-beginner.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
* a Beginner issue in this repository.
44
*
55
* ELIGIBILITY RULES:
6-
* - Committers (write / maintain / admin) bypass all checks.
6+
* - Repository team members (triage / write / maintain / admin)
7+
* bypass all eligibility and capacity checks.
78
* - Contributors on the spam list are never eligible.
8-
* - Contributors must have completed at least one Good First Issue.
9+
* - Contributors must have completed at least `REQUIRED_GFI_COUNT`
10+
* Good First Issues.
911
* - Contributors may have fewer than `MAX_OPEN_ASSIGNED_ISSUES`
1012
* open issue assignments.
1113
*
@@ -27,23 +29,23 @@
2729
* @param {string} params.username - GitHub username to check
2830
* @returns {Promise<boolean>} Whether the contributor may be assigned a Beginner issue
2931
*/
30-
const { isCommitter } = require('./is-committer');
32+
const { isTeam } = require('./is-team');
3133
const { isOnSpamList } = require('../counts/is-on-spam-list');
3234
const { hasCompletedGfi } = require('./has-gfi');
33-
const { countOpenAssignedIssues } = require('./count-open-assigned-issues');
35+
const { countOpenAssignedIssues } = require('../counts/count-open-assigned-issues');
3436

3537
/**
3638
* Maximum number of open issues allowed for Beginner eligibility.
3739
*
38-
* This value represents a policy decision and should be kept in sync
40+
* This value represents a policy decision and must stay in sync
3941
* with guard messaging and documentation.
4042
*/
4143
const MAX_OPEN_ASSIGNED_ISSUES = 2;
4244

4345
/**
4446
* Number of Good First Issues required to qualify for Beginner issues.
4547
*
46-
* Expressed here explicitly to keep policy decisions out of helpers.
48+
* Expressed explicitly to keep policy decisions out of helpers.
4749
*/
4850
const REQUIRED_GFI_COUNT = 1;
4951

@@ -60,9 +62,9 @@ const hasBeginnerEligibility = async ({
6062
username,
6163
});
6264

63-
// Committers bypass all Beginner eligibility checks.
64-
if (await isCommitter({ github, owner, repo, username })) {
65-
console.log('[has-beginner-eligibility] Skipped: user is committer', {
65+
// Repository team members bypass all Beginner eligibility checks.
66+
if (await isTeam({ github, owner, repo, username })) {
67+
console.log('[has-beginner-eligibility] Skipped: user is team member', {
6668
username,
6769
});
6870
return true;
@@ -77,7 +79,7 @@ const hasBeginnerEligibility = async ({
7779
}
7880

7981
// Enforce capacity limits for open issue assignments.
80-
// This helper fails open, returning a large number on error,
82+
// This helper fails open and returns a large number on error,
8183
// which conservatively blocks assignment.
8284
const openAssignedCount = await countOpenAssignedIssues({
8385
github,
@@ -95,8 +97,7 @@ const hasBeginnerEligibility = async ({
9597
return false;
9698
}
9799

98-
// Verify that the contributor has completed the required number
99-
// of Good First Issues.
100+
// Verify Good First Issue completion requirement.
100101
const hasRequiredGfi = await hasCompletedGfi({
101102
github,
102103
owner,

.github/scripts/lib/eligibility/has-eligibility-03-intermediate.js

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
* Determines whether a contributor is eligible to be assigned
33
* an Intermediate issue in this repository.
44
*
5-
* ELIGIBILITY RULES (for non-triage contributors):
5+
* ELIGIBILITY RULES:
6+
* - Repository team members (triage / write / maintain / admin)
7+
* bypass all eligibility and capacity checks.
68
* - Contributors on the spam list are never eligible.
79
* - Contributors must have completed at least:
810
* - `REQUIRED_GFI_COUNT` Good First Issues
911
* - `REQUIRED_BEGINNER_COUNT` Beginner issues
1012
* - Contributors may have fewer than `MAX_OPEN_ASSIGNED_ISSUES`
1113
* open issue assignments.
1214
*
13-
* EXEMPTION RULE:
14-
* - Triage members and above (triage / write / maintain / admin)
15-
* bypass all eligibility checks and capacity limits.
16-
*
1715
* IMPORTANT NOTES:
1816
* - This helper is policy-only.
1917
* - It does NOT assign issues.
@@ -32,17 +30,17 @@
3230
* @param {string} params.username - GitHub username to check
3331
* @returns {Promise<boolean>} Whether the contributor may be assigned an Intermediate issue
3432
*/
35-
const { isTriager } = require('./is-triager');
33+
const { isTeam } = require('./is-team');
3634
const { isOnSpamList } = require('../counts/is-on-spam-list');
3735
const { hasCompletedGfi } = require('./has-gfi');
3836
const { hasCompletedBeginner } = require('./has-beginner');
39-
const { countOpenAssignedIssues } = require('./count-open-assigned-issues');
37+
const { countOpenAssignedIssues } = require('../counts/count-open-assigned-issues');
4038

4139
/**
4240
* Maximum number of open issues allowed for Intermediate eligibility.
4341
*
44-
* This value represents a policy decision and should be kept
45-
* in sync with guard messaging and documentation.
42+
* This value represents a policy decision and must remain in sync
43+
* with guard messaging and documentation.
4644
*/
4745
const MAX_OPEN_ASSIGNED_ISSUES = 2;
4846

@@ -71,20 +69,20 @@ const hasIntermediateEligibility = async ({
7169
username,
7270
});
7371

74-
// Contributors on the spam list are never eligible
75-
if (await isOnSpamList({ github, owner, repo, username })) {
76-
console.log('[has-intermediate-eligibility] Exit: user is on spam list', {
72+
// Repository team members bypass all Intermediate eligibility checks.
73+
if (await isTeam({ github, owner, repo, username })) {
74+
console.log('[has-intermediate-eligibility] Skipped: user is team member', {
7775
username,
7876
});
79-
return false;
77+
return true;
8078
}
8179

82-
// Triage members and above bypass all eligibility checks
83-
if (await isTriager({ github, owner, repo, username })) {
84-
console.log('[has-intermediate-eligibility] Skipped: user is triage+', {
80+
// Contributors on the spam list are never eligible.
81+
if (await isOnSpamList({ github, owner, repo, username })) {
82+
console.log('[has-intermediate-eligibility] Exit: user is on spam list', {
8583
username,
8684
});
87-
return true;
85+
return false;
8886
}
8987

9088
// Enforce capacity limits for open issue assignments.
@@ -106,7 +104,7 @@ const hasIntermediateEligibility = async ({
106104
return false;
107105
}
108106

109-
// Verify Good First Issue completion requirement
107+
// Verify Good First Issue completion requirement.
110108
const hasRequiredGfi = await hasCompletedGfi({
111109
github,
112110
owner,
@@ -123,7 +121,7 @@ const hasIntermediateEligibility = async ({
123121
return false;
124122
}
125123

126-
// Verify Beginner Issue completion requirement
124+
// Verify Beginner Issue completion requirement.
127125
const hasRequiredBeginner = await hasCompletedBeginner({
128126
github,
129127
owner,
@@ -140,10 +138,11 @@ const hasIntermediateEligibility = async ({
140138
return false;
141139
}
142140

143-
// Contributor meets all Intermediate eligibility requirements
144-
console.log('[has-intermediate-eligibility] Success: contributor eligible for Intermediate issues', {
145-
username,
146-
});
141+
// Contributor meets all Intermediate eligibility requirements.
142+
console.log(
143+
'[has-intermediate-eligibility] Success: contributor eligible for Intermediate issues',
144+
{ username }
145+
);
147146

148147
return true;
149148
};

.github/scripts/lib/eligibility/has-eligibility-04-advanced.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22
* Determines whether a contributor is eligible to be assigned
33
* an Advanced issue in this repository.
44
*
5-
* ELIGIBILITY RULES (for non-committers):
5+
* ELIGIBILITY RULES:
6+
* - Committers (write / maintain / admin) bypass all eligibility
7+
* checks and capacity limits.
68
* - Contributors on the spam list are never eligible.
79
* - Contributors must have completed at least
810
* `REQUIRED_INTERMEDIATE_COUNT` Intermediate issues.
911
* - Contributors may have fewer than `MAX_OPEN_ASSIGNED_ISSUES`
1012
* open issue assignments.
1113
*
12-
* EXEMPTION RULE:
13-
* - Committers (write / maintain / admin) bypass all eligibility
14-
* checks and capacity limits.
15-
* - Triage members are NOT exempt and must meet all requirements.
16-
*
1714
* IMPORTANT NOTES:
15+
* - Triage members are NOT exempt and must meet all requirements.
1816
* - This helper is policy-only.
1917
* - It does NOT assign issues.
2018
* - It does NOT post comments.
@@ -34,8 +32,8 @@
3432
*/
3533
const { isCommitter } = require('./is-committer');
3634
const { isOnSpamList } = require('../counts/is-on-spam-list');
37-
const { hasCompletedAdvanced } = require('./has-advanced');
38-
const { countOpenAssignedIssues } = require('./count-open-assigned-issues');
35+
const { hasCompletedIntermediate } = require('./has-intermediate');
36+
const { countOpenAssignedIssues } = require('../counts/count-open-assigned-issues');
3937

4038
/**
4139
* Maximum number of open issues allowed for Advanced eligibility.
@@ -72,7 +70,7 @@ const hasAdvancedEligibility = async ({
7270
return true;
7371
}
7472

75-
// Contributors on the spam list are never eligible for Advanced issues.
73+
// Contributors on the spam list are never eligible.
7674
if (await isOnSpamList({ github, owner, repo, username })) {
7775
console.log('[has-advanced-eligibility] Exit: user is on spam list', {
7876
username,
@@ -100,7 +98,7 @@ const hasAdvancedEligibility = async ({
10098
}
10199

102100
// Verify Intermediate issue completion requirement.
103-
const hasRequiredIntermediate = await hasCompletedAdvanced({
101+
const hasRequiredIntermediate = await hasCompletedIntermediate({
104102
github,
105103
owner,
106104
repo,
@@ -120,9 +118,10 @@ const hasAdvancedEligibility = async ({
120118
}
121119

122120
// Contributor meets all Advanced eligibility requirements.
123-
console.log('[has-advanced-eligibility] Success: contributor eligible for Advanced issues', {
124-
username,
125-
});
121+
console.log(
122+
'[has-advanced-eligibility] Success: contributor eligible for Advanced issues',
123+
{ username }
124+
);
126125

127126
return true;
128127
};

0 commit comments

Comments
 (0)