66 workflow_dispatch :
77
88permissions :
9- pull-requests : write
10- issues : write
119 contents : read
1210
1311jobs :
1412 check-submission :
1513 name : Validate submission
1614 runs-on : ubuntu-latest
17- permissions :
18- pull-requests : write
19- issues : write
20- contents : read
2115
2216 steps :
2317 - name : Checkout PR branch
4337 echo "::error::Missing required files: ${MISSING[*]}"
4438 else
4539 echo "status=pass" >> $GITHUB_OUTPUT
40+ echo "::notice::All required files found"
4641 fi
4742
4843 - name : PHP syntax check
6560 echo "::error::PHP syntax errors in: ${ERRORS[*]}"
6661 else
6762 echo "status=pass" >> $GITHUB_OUTPUT
63+ echo "::notice::All files pass PHP syntax check"
6864 fi
6965
7066 - name : Check file headers for student info
@@ -86,18 +82,23 @@ jobs:
8682 done
8783 if [ ${#MISSING_HEADERS[@]} -gt 0 ]; then
8884 echo "status=warn" >> $GITHUB_OUTPUT
85+ echo "::warning::Headers missing or incomplete in: ${MISSING_HEADERS[*]}"
8986 else
9087 echo "status=pass" >> $GITHUB_OUTPUT
88+ echo "::notice::File headers look good"
9189 fi
9290
9391 - name : Check commit message convention
9492 id : commits
9593 run : |
9694 LATEST_MSG=$(git log --oneline -1 HEAD | sed 's/^[a-f0-9]* //')
95+ echo "Latest commit: $LATEST_MSG"
9796 if echo "$LATEST_MSG" | grep -Eqi "feat:|fix:|lab3"; then
9897 echo "status=pass" >> $GITHUB_OUTPUT
98+ echo "::notice::Commit message format OK"
9999 else
100100 echo "status=warn" >> $GITHUB_OUTPUT
101+ echo "::warning::Commit message should follow: feat: lab3 complete - REGNO/YEAR"
101102 fi
102103
103104 - name : Check TODO stubs have been worked on
@@ -115,56 +116,59 @@ jobs:
115116 done
116117 if [ "$UNTOUCHED" -gt 0 ]; then
117118 echo "status=warn" >> $GITHUB_OUTPUT
119+ echo "::warning::$UNTOUCHED untouched TODO stub(s) found"
118120 else
119121 echo "status=pass" >> $GITHUB_OUTPUT
122+ echo "::notice::No blank TODO stubs found"
120123 fi
121124
122- - name : Post results as PR comment
123- if : github.event_name == 'pull_request'
124- uses : actions/github-script@v7
125- with :
126- github-token : ${{ secrets.GITHUB_TOKEN }}
127- script : |
128- const f = '${{ steps.files.outputs.status }}';
129- const s = '${{ steps.syntax.outputs.status }}';
130- const h = '${{ steps.headers.outputs.status }}';
131- const c = '${{ steps.commits.outputs.status }}';
132- const t = '${{ steps.stubs.outputs.status }}';
133-
134- const files = f !== 'fail' ? ':white_check_mark:' : ':x:';
135- const syntax = s !== 'fail' ? ':white_check_mark:' : ':x:';
136- const headers = h === 'pass' ? ':white_check_mark:' : ':warning:';
137- const commits = c === 'pass' ? ':white_check_mark:' : ':warning:';
138- const stubs = t === 'pass' ? ':white_check_mark:' : ':warning:';
139-
140- const allPass = s !== 'fail' && f !== 'fail';
141- const badge = allPass
142- ? ':green_circle: Ready for review'
143- : ':red_circle: Issues found - please fix before deadline';
144-
145- const lines = [
146- '## ICS 2371 Lab 3 - Automated Check Results',
147- '',
148- badge,
149- '',
150- '| Check | Result | Marks at stake |',
151- '|---|---|---|',
152- '| Required files present | ' + files + ' | 2 |',
153- '| PHP syntax valid | ' + syntax + ' | 3 |',
154- '| File headers with reg number | ' + headers + ' | 1 |',
155- '| Commit message format | ' + commits + ' | 1 |',
156- '| TODO stubs worked on | ' + stubs + ' | 2 |',
157- '| PR template filled | _(checked by lecturer)_ | 1 |',
158- '',
159- '> :white_check_mark: pass :warning: warning (marks may be deducted) :x: fail',
160- '> Lecturer will review and confirm final marks after the deadline.',
161- '',
162- '_Automated check. Raise a GitHub Issue if you believe a result is incorrect._'
163- ];
164-
165- await github.rest.issues.createComment({
166- issue_number: context.issue.number,
167- owner: context.repo.owner,
168- repo: context.repo.repo,
169- body: lines.join('\n')
170- });
125+ - name : Write results to Job Summary
126+ if : always()
127+ run : |
128+ F="${{ steps.files.outputs.status }}"
129+ S="${{ steps.syntax.outputs.status }}"
130+ H="${{ steps.headers.outputs.status }}"
131+ C="${{ steps.commits.outputs.status }}"
132+ T="${{ steps.stubs.outputs.status }}"
133+
134+ files_r=$( [ "$F" != "fail" ] && echo "✅" || echo "❌" )
135+ syntax_r=$( [ "$S" != "fail" ] && echo "✅" || echo "❌" )
136+ headers_r=$( [ "$H" = "pass" ] && echo "✅" || echo "⚠️" )
137+ commits_r=$( [ "$C" = "pass" ] && echo "✅" || echo "⚠️" )
138+ stubs_r=$( [ "$T" = "pass" ] && echo "✅" || echo "⚠️" )
139+
140+ if [ "$S" != "fail" ] && [ "$F" != "fail" ]; then
141+ BADGE="🟢 Ready for review"
142+ else
143+ BADGE="🔴 Issues found — student must fix before deadline"
144+ fi
145+
146+ cat >> $GITHUB_STEP_SUMMARY << EOF
147+ ## ICS 2371 Lab 3 — Automated Check Results
148+
149+ **$BADGE**
150+
151+ | Check | Result | Marks at stake |
152+ |---|---|---|
153+ | Required files present | $files_r | 2 |
154+ | PHP syntax valid | $syntax_r | 3 |
155+ | File headers with reg number | $headers_r | 1 |
156+ | Commit message format | $commits_r | 1 |
157+ | TODO stubs worked on | $stubs_r | 2 |
158+ | PR template filled | _(check manually)_ | 1 |
159+
160+ > ✅ pass · ⚠️ warning (marks may be deducted) · ❌ fail
161+ >
162+ > Review the Files changed tab and confirm final marks after the deadline.
163+ EOF
164+
165+ - name : Fail job if critical checks failed
166+ if : always()
167+ run : |
168+ F="${{ steps.files.outputs.status }}"
169+ S="${{ steps.syntax.outputs.status }}"
170+ if [ "$F" = "fail" ] || [ "$S" = "fail" ]; then
171+ echo "Critical checks failed — files missing or PHP syntax errors present"
172+ exit 1
173+ fi
174+ echo "All critical checks passed"
0 commit comments