-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (57 loc) · 2.01 KB
/
classroom.yml
File metadata and controls
65 lines (57 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: GitHub Classroom Workflow
on:
push:
branches:
- '*'
- '!badges'
jobs:
build:
name: Autograding
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
# add id to step so outputs can be referenced
- uses: education/autograding@v1
id: autograder
continue-on-error: true
env:
MPLBACKEND: agg
# make dir for badges
- name: badges branch and make dir
run: |
git checkout badges || git checkout -b badges
mkdir -p .github/badges
# store points in badges branch for automatic retrieval
- name: points.csv file
run: echo "${{ steps.autograder.outputs.Points }}" | tr / , > .github/badges/points.csv
# make points badge
- name: points badge
uses: emibcn/badge-action@v1
with:
LABEL: 'Points'
STATUS: ${{ steps.autograder.outputs.Points }}
COLOR: cyan
path: '.github/badges/points.svg'
# commit and push badge if score has changed
- name: Commit badge and points.csv
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Action[bot]"
git add '.github/badges/points.svg'
git add '.github/badges/points.csv'
git commit -m "Add/Update badge and points.csv"
continue-on-error: true
- name: Push badge commit
uses: ad-m/github-push-action@master
if: ${{ success() }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: badges
force: true
# fail job if autograder returns failed
- name: check autograder pass fail
if: ${{ steps.autograder.outcome != 'success' }}
run: exit 1