File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,8 +35,26 @@ issue_has_gfi() {
3535 [[ " $has " == " true" ]]
3636}
3737
38+ # Count open assignments for a user
39+ # For triage users (mentors), excludes issues with 'mentor-duty' label
40+ # This allows mentors to be assigned to mentorship issues without consuming their assignment limit
3841assignments_count () {
39- gh issue list --repo " ${REPO} " --assignee " ${ASSIGNEE} " --state open --limit 100 --json number --jq ' length'
42+ local permission=" ${1:- none} "
43+
44+ if [[ " $permission " == " triage" ]]; then
45+ echo " Triage user detected — excluding mentor-duty issues from count." >&2
46+ # For triage users, exclude issues with 'mentor-duty' label
47+ gh api " repos/${REPO} /issues?per_page=100&page=1" \
48+ -f assignee=" ${ASSIGNEE} " \
49+ -f state=open \
50+ --jq ' .[]
51+ | select(.pull_request == null)
52+ | select(any(.labels[]; .name == "mentor-duty") | not)
53+ | .number' | grep -c . || echo 0
54+ else
55+ # For non-triage users, count all open assignments
56+ gh issue list --repo " ${REPO} " --assignee " ${ASSIGNEE} " --state open --limit 100 --json number --jq ' length'
57+ fi
4058}
4159
4260remove_assignee () {
@@ -118,7 +136,7 @@ if is_spam_user; then
118136 echo " User is in spam list. Applying restricted assignment rules."
119137fi
120138
121- COUNT=" $( assignments_count) "
139+ COUNT=" $( assignments_count " $PERMISSION " ) "
122140
123141# Apply assignment rules
124142if [[ " $SPAM " == " true" ]]; then
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
2929- Format ` tests/unit/endpoint_test.py ` using black. (` #1792 ` )
3030
3131### .github
32+ - Added triage members max assignment is protected from being a mentor in ` .github/scripts/bot-assignment-check.sh ` . (#1718 )
3233- Revert PythonBot workflow to restore previous stable behavior. (#1825 )
3334- Added GitHub Actions workflow to remind draft PR authors to mark ready for review after pushing changes. (#1722 )
3435- Fixed bot workflow runtime failure caused by strict ` FAILED_WORKFLOW_NAME ` validation. (` #1690 ` )
You can’t perform that action at this time.
0 commit comments