Skip to content

Commit 10ef238

Browse files
authored
Merge pull request #197 from Community-Access/fix/grading-reliability-sync-v2
fix: stabilize autograder workflows from validated template snapshots
2 parents 4164e11 + 37fba60 commit 10ef238

5 files changed

Lines changed: 373 additions & 35 deletions

File tree

‎learning-room/.github/workflows/autograder-capstone.yml‎

Lines changed: 74 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ permissions:
1414
contents: read
1515
pull-requests: write
1616

17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
19+
cancel-in-progress: true
20+
1721
jobs:
1822
validate-agent:
1923
name: Verify Agent File
@@ -28,44 +32,42 @@ jobs:
2832
run: |
2933
# Find new/modified .md files in agents/ or community-agents/
3034
AGENTS=$(find agents community-agents -name '*.md' 2>/dev/null || true)
31-
35+
3236
if [ -z "$AGENTS" ]; then
3337
echo "found=false" >> "$GITHUB_OUTPUT"
3438
exit 0
3539
fi
36-
40+
3741
echo "found=true" >> "$GITHUB_OUTPUT"
3842
FIRST=$(echo "$AGENTS" | head -1)
3943
echo "file=$FIRST" >> "$GITHUB_OUTPUT"
40-
CHECK_FILE="/tmp/capstone-agent.md"
41-
sed '1s/^\xEF\xBB\xBF//' "$FIRST" > "$CHECK_FILE"
42-
44+
4345
ERRORS=""
44-
46+
4547
# Check YAML frontmatter exists (starts with ---)
46-
if head -1 "$CHECK_FILE" | grep -q '^---'; then
48+
if head -1 "$FIRST" | grep -q '^---'; then
4749
echo "has_frontmatter=true" >> "$GITHUB_OUTPUT"
4850
else
4951
echo "has_frontmatter=false" >> "$GITHUB_OUTPUT"
5052
ERRORS="missing YAML frontmatter"
5153
fi
52-
54+
5355
# Check for responsibilities section
54-
if grep -qi '## responsibilities\|## what this agent does' "$CHECK_FILE"; then
56+
if grep -qi '## responsibilities\|## what this agent does' "$FIRST"; then
5557
echo "has_responsibilities=true" >> "$GITHUB_OUTPUT"
5658
else
5759
echo "has_responsibilities=false" >> "$GITHUB_OUTPUT"
5860
ERRORS="$ERRORS${ERRORS:+, }missing responsibilities section"
5961
fi
60-
62+
6163
# Check for guardrails section
62-
if grep -qi '## guardrails\|## limitations\|## boundaries' "$CHECK_FILE"; then
64+
if grep -qi '## guardrails\|## limitations\|## boundaries' "$FIRST"; then
6365
echo "has_guardrails=true" >> "$GITHUB_OUTPUT"
6466
else
6567
echo "has_guardrails=false" >> "$GITHUB_OUTPUT"
6668
ERRORS="$ERRORS${ERRORS:+, }missing guardrails section"
6769
fi
68-
70+
6971
echo "errors=$ERRORS" >> "$GITHUB_OUTPUT"
7072
7173
- name: Post result
@@ -105,13 +107,70 @@ jobs:
105107
'Excellent capstone work!'
106108
].join('\n');
107109
}
110+
const MARKER = '## Challenge 16:';
108111
try {
109-
await github.rest.issues.createComment({
112+
const { data: comments } = await github.rest.issues.listComments({
110113
owner: context.repo.owner,
111114
repo: context.repo.repo,
112-
issue_number: context.issue.number,
113-
body
115+
issue_number: context.issue.number
114116
});
117+
const existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(MARKER));
118+
if (existing) {
119+
await github.rest.issues.updateComment({
120+
owner: context.repo.owner,
121+
repo: context.repo.repo,
122+
comment_id: existing.id,
123+
body
124+
});
125+
} else {
126+
await github.rest.issues.createComment({
127+
owner: context.repo.owner,
128+
repo: context.repo.repo,
129+
issue_number: context.issue.number,
130+
body
131+
});
132+
}
115133
} catch (error) {
116134
console.error('Could not post Challenge 16 result:', error.message);
117135
}
136+
137+
- name: Post workflow error notice
138+
if: failure()
139+
uses: actions/github-script@v7
140+
with:
141+
script: |
142+
const MARKER = '## Challenge 16:';
143+
const body = [
144+
'## Challenge 16: Check could not complete',
145+
'',
146+
'The automated agent file check ran into an unexpected error. Your work is not affected.',
147+
'Keep going and ask your facilitator, or mention @facilitator in a comment.',
148+
'',
149+
'---',
150+
'*Automated message from Learning Room Bot.*'
151+
].join('\n');
152+
try {
153+
const { data: comments } = await github.rest.issues.listComments({
154+
owner: context.repo.owner,
155+
repo: context.repo.repo,
156+
issue_number: context.issue.number
157+
});
158+
const existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(MARKER));
159+
if (existing) {
160+
await github.rest.issues.updateComment({
161+
owner: context.repo.owner,
162+
repo: context.repo.repo,
163+
comment_id: existing.id,
164+
body
165+
});
166+
} else {
167+
await github.rest.issues.createComment({
168+
owner: context.repo.owner,
169+
repo: context.repo.repo,
170+
issue_number: context.issue.number,
171+
body
172+
});
173+
}
174+
} catch (err) {
175+
console.error('Could not post error notice:', err.message);
176+
}

‎learning-room/.github/workflows/autograder-conflicts.yml‎

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ permissions:
1111
contents: read
1212
pull-requests: write
1313

14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
16+
cancel-in-progress: true
17+
1418
jobs:
1519
check-conflict-markers:
1620
name: Verify Conflict Resolution
@@ -75,13 +79,70 @@ jobs:
7579
'No conflict markers found and the file has substantive content. Well done!'
7680
].join('\n');
7781
}
82+
const MARKER = '## Challenge 7:';
7883
try {
79-
await github.rest.issues.createComment({
84+
const { data: comments } = await github.rest.issues.listComments({
8085
owner: context.repo.owner,
8186
repo: context.repo.repo,
82-
issue_number: context.issue.number,
83-
body
87+
issue_number: context.issue.number
8488
});
89+
const existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(MARKER));
90+
if (existing) {
91+
await github.rest.issues.updateComment({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
comment_id: existing.id,
95+
body
96+
});
97+
} else {
98+
await github.rest.issues.createComment({
99+
owner: context.repo.owner,
100+
repo: context.repo.repo,
101+
issue_number: context.issue.number,
102+
body
103+
});
104+
}
85105
} catch (error) {
86106
console.error('Could not post Challenge 7 result:', error.message);
87107
}
108+
109+
- name: Post workflow error notice
110+
if: failure()
111+
uses: actions/github-script@v7
112+
with:
113+
script: |
114+
const MARKER = '## Challenge 7:';
115+
const body = [
116+
'## Challenge 7: Check could not complete',
117+
'',
118+
'The automated conflict marker check ran into an unexpected error. Your work is not affected.',
119+
'Keep going and ask your facilitator, or mention @facilitator in a comment.',
120+
'',
121+
'---',
122+
'*Automated message from Learning Room Bot.*'
123+
].join('\n');
124+
try {
125+
const { data: comments } = await github.rest.issues.listComments({
126+
owner: context.repo.owner,
127+
repo: context.repo.repo,
128+
issue_number: context.issue.number
129+
});
130+
const existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(MARKER));
131+
if (existing) {
132+
await github.rest.issues.updateComment({
133+
owner: context.repo.owner,
134+
repo: context.repo.repo,
135+
comment_id: existing.id,
136+
body
137+
});
138+
} else {
139+
await github.rest.issues.createComment({
140+
owner: context.repo.owner,
141+
repo: context.repo.repo,
142+
issue_number: context.issue.number,
143+
body
144+
});
145+
}
146+
} catch (err) {
147+
console.error('Could not post error notice:', err.message);
148+
}

‎learning-room/.github/workflows/autograder-local-commit.yml‎

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ permissions:
1111
contents: read
1212
pull-requests: write
1313

14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
16+
cancel-in-progress: true
17+
1418
jobs:
1519
check-local-commit:
1620
name: Verify Local Commit Exists
@@ -66,13 +70,70 @@ jobs:
6670
'Your local Git workflow is working. Well done!'
6771
].join('\n');
6872
}
73+
const MARKER = '## Challenge 10:';
6974
try {
70-
await github.rest.issues.createComment({
75+
const { data: comments } = await github.rest.issues.listComments({
7176
owner: context.repo.owner,
7277
repo: context.repo.repo,
73-
issue_number: context.issue.number,
74-
body
78+
issue_number: context.issue.number
7579
});
80+
const existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(MARKER));
81+
if (existing) {
82+
await github.rest.issues.updateComment({
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
comment_id: existing.id,
86+
body
87+
});
88+
} else {
89+
await github.rest.issues.createComment({
90+
owner: context.repo.owner,
91+
repo: context.repo.repo,
92+
issue_number: context.issue.number,
93+
body
94+
});
95+
}
7696
} catch (error) {
7797
console.error('Could not post Challenge 10 result:', error.message);
7898
}
99+
100+
- name: Post workflow error notice
101+
if: failure()
102+
uses: actions/github-script@v7
103+
with:
104+
script: |
105+
const MARKER = '## Challenge 10:';
106+
const body = [
107+
'## Challenge 10: Check could not complete',
108+
'',
109+
'The automated local commit check ran into an unexpected error. Your work is not affected.',
110+
'Keep going and ask your facilitator, or mention @facilitator in a comment.',
111+
'',
112+
'---',
113+
'*Automated message from Learning Room Bot.*'
114+
].join('\n');
115+
try {
116+
const { data: comments } = await github.rest.issues.listComments({
117+
owner: context.repo.owner,
118+
repo: context.repo.repo,
119+
issue_number: context.issue.number
120+
});
121+
const existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(MARKER));
122+
if (existing) {
123+
await github.rest.issues.updateComment({
124+
owner: context.repo.owner,
125+
repo: context.repo.repo,
126+
comment_id: existing.id,
127+
body
128+
});
129+
} else {
130+
await github.rest.issues.createComment({
131+
owner: context.repo.owner,
132+
repo: context.repo.repo,
133+
issue_number: context.issue.number,
134+
body
135+
});
136+
}
137+
} catch (err) {
138+
console.error('Could not post error notice:', err.message);
139+
}

0 commit comments

Comments
 (0)