Skip to content

Commit c5d7f2d

Browse files
authored
Merge branch 'main' into feat/getAccInfo-tck#2040
2 parents ad4ff0b + a046740 commit c5d7f2d

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

.github/scripts/bot-assignment-check.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/bin/bash
22
set -Eeuo pipefail
33

4+
# Configuration for labels (overridable from workflow env)
5+
MENTOR_LABEL="${MENTOR_LABEL:-notes: mentor-duty}"
6+
if [ -z "${MENTOR_LABEL}" ]; then
7+
echo "Error: Missing required environment variable (MENTOR_LABEL)." >&2
8+
exit 1
9+
fi
10+
411
# Validate required env vars
512
if [ -z "${ASSIGNEE:-}" ] || [ -z "${ISSUE_NUMBER:-}" ] || [ -z "${REPO:-}" ]; then
613
echo "Error: Missing required environment variables (ASSIGNEE, ISSUE_NUMBER, REPO)."
@@ -36,20 +43,20 @@ issue_has_gfi() {
3643
}
3744

3845
# Count open assignments for a user
39-
# For triage users (mentors), excludes issues with 'mentor-duty' label
46+
# For triage users (mentors), excludes issues with '${MENTOR_LABEL}' label
4047
# This allows mentors to be assigned to mentorship issues without consuming their assignment limit
4148
assignments_count() {
4249
local permission="${1:-none}"
4350

4451
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
52+
echo "Triage user detected — excluding ${MENTOR_LABEL} issues from count." >&2
53+
# For triage users, exclude issues with the configured mentor label
4754
gh api "repos/${REPO}/issues?per_page=100&page=1" \
4855
-f assignee="${ASSIGNEE}" \
4956
-f state=open \
50-
--jq '.[]
57+
--jq --arg mentor_label "$MENTOR_LABEL" '.[]
5158
| select(.pull_request == null)
52-
| select(any(.labels[]; .name == "mentor-duty") | not)
59+
| select(any(.labels[]; .name == $mentor_label) | not)
5360
| .number' | grep -c . || echo 0
5461
else
5562
# For non-triage users, count all open assignments

.github/workflows/bot-assignment-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
ASSIGNEE: ${{ github.event.assignee.login }}
2626
ISSUE_NUMBER: ${{ github.event.issue.number }}
2727
REPO: ${{ github.repository }}
28+
MENTOR_LABEL: "notes: mentor-duty"
2829
run: |
2930
# Make script executable (just in case permissions were lost during checkout)
3031
chmod +x .github/scripts/bot-assignment-check.sh

0 commit comments

Comments
 (0)