Skip to content

Commit 8091634

Browse files
committed
feat: use autograding-grading-reporter for Classroom dashboard scores
1 parent d238520 commit 8091634

1 file changed

Lines changed: 37 additions & 3 deletions

File tree

.github/workflows/classroom.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,49 @@ on:
66

77
permissions:
88
checks: write
9+
actions: read
10+
contents: read
911

1012
jobs:
1113
report:
1214
runs-on: ubuntu-latest
1315
steps:
14-
- name: Report score to Classroom
16+
- name: Build grader result
17+
env:
18+
POINTS: ${{ github.event.client_payload.points }}
19+
MAX: ${{ github.event.client_payload.max }}
1520
run: |
16-
echo "::notice title=Autograding complete::Points ${{ github.event.client_payload.points }}/${{ github.event.client_payload.max }}"
17-
echo '::notice title=Autograding report::{"totalPoints":${{ github.event.client_payload.points }},"maxPoints":${{ github.event.client_payload.max }}}'
21+
RESULT=$(python3 -c "
22+
import json, base64, os
23+
pts = int(os.environ.get('POINTS') or '0')
24+
mx = int(os.environ.get('MAX') or '50')
25+
r = {
26+
'version': 1,
27+
'status': 'pass' if pts == mx else 'fail',
28+
'max_score': mx,
29+
'tests': [{
30+
'name': 'Lab1 Autograding',
31+
'status': 'pass' if pts == mx else 'fail',
32+
'score': pts,
33+
'max_score': mx,
34+
'message': f'{pts}/{mx}',
35+
'test_code': '',
36+
'filename': '',
37+
'line_no': 0,
38+
'duration': 0
39+
}]
40+
}
41+
print(base64.b64encode(json.dumps(r).encode()).decode())
42+
")
43+
echo "GRADE_RESULTS=$RESULT" >> "$GITHUB_ENV"
44+
45+
- name: Autograding Reporter
46+
uses: classroom-resources/autograding-grading-reporter@v1
47+
env:
48+
GRADE_RESULTS: ${{ env.GRADE_RESULTS }}
49+
with:
50+
runners: grade
51+
1852
- name: Show detailed results
1953
env:
2054
REPORT: ${{ github.event.client_payload.summary }}

0 commit comments

Comments
 (0)