Skip to content

Commit f023da7

Browse files
committed
Address copilot review comment
#2 (comment)
1 parent 5b4b3e8 commit f023da7

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

facility_management/20824.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,25 @@ jobs:
2424
USER_ID=$(jq -r '.user.id' setup_data.json)
2525
EXPECTED_FACILITY_ID=$(jq -r '.facility_management.facility_id // empty' setup_data.json)
2626
27+
# Missing user.id is a course-config bug (bootstrap action didn't run) —
28+
# not student-recoverable, so fail hard and surface in CI logs.
2729
if [ -z "$USER_ID" ] || [ "$USER_ID" = "null" ]; then
2830
echo "::error::Could not read user.id from setup_data.json"
2931
exit 1
3032
fi
33+
34+
# Missing facility_id IS student-recoverable: the previous target
35+
# (Create Facility) hasn't been *passed* yet. Pupilfirst lets students
36+
# submit this target after merely *submitting* the prerequisite, so we
37+
# need to give actionable feedback here instead of failing the job.
3138
if [ -z "$EXPECTED_FACILITY_ID" ] || [ "$EXPECTED_FACILITY_ID" = "null" ]; then
32-
echo "::error::Could not read facility_management.facility_id from setup_data.json — has the previous target (Create Facility) been completed?"
33-
exit 1
39+
FEEDBACK="Please pass the **Create Facility** target first. Submitting it isn't enough — it needs a passing grade so this evaluation can verify the department belongs to your facility."
40+
jq -n \
41+
--arg status "failure" \
42+
--arg feedback "$FEEDBACK" \
43+
'{status: $status, feedback: $feedback}' > report.json
44+
echo "skip_checks=true" >> $GITHUB_ENV
45+
exit 0
3446
fi
3547
3648
echo "user_id=$USER_ID" >> $GITHUB_OUTPUT
@@ -62,6 +74,7 @@ jobs:
6274
6375
# ── Parse department URL from submission ──
6476
- name: Parse submission data
77+
if: env.skip_checks != 'true'
6578
id: parse
6679
run: |
6780
SUBMISSION_ID=$(jq -r '.id' submission.json)
@@ -100,7 +113,7 @@ jobs:
100113
101114
# ── Validate URL was parsed successfully ──
102115
- name: Validate parsed URL
103-
if: steps.parse.outputs.valid != 'true'
116+
if: env.skip_checks != 'true' && steps.parse.outputs.valid != 'true'
104117
env:
105118
DEPARTMENT_URL: ${{ steps.parse.outputs.department_url }}
106119
run: |

0 commit comments

Comments
 (0)