Skip to content

Commit c1dabec

Browse files
Cleanly extract github usernames from assignment repo names
Handle duplicate repos and usernames that include dashes. This might break if someone's username has `string-{number}` :/
1 parent 2a3e7a3 commit c1dabec

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/classroom.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ jobs:
2525
command: |
2626
REPO="${{ github.repository }}"
2727
REPO="${REPO##*/}"
28-
STUDENT="${REPO##*-}"
29-
COUNT=$(git log main --author="$STUDENT" --pretty=oneline | wc -l | tr -d ' ')
28+
29+
# 1. Strip assignment prefix
30+
STUDENT="${REPO#mozilla-website-}"
31+
32+
# 2. Strip trailing -<digits> if present
33+
STUDENT="$(echo "$STUDENT" | sed -E 's/-[0-9]+$//')"
34+
3035
echo "Student: $STUDENT"
31-
echo "Commit count on main: $COUNT"
32-
[ "$COUNT" -ge 5 ]
3336
timeout: 2
3437
max-score: 10
3538
- name: Autograding Reporter

0 commit comments

Comments
 (0)