Skip to content

Commit 8ce0da2

Browse files
authored
Merge pull request #195 from Community-Access/fix/grading-reliability-sync
fix: stabilize grading workflows and add watchdog
2 parents a44831b + 88cbfdc commit 8ce0da2

5 files changed

Lines changed: 0 additions & 386 deletions

File tree

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +0,0 @@
1-
name: "Challenge 16: Capstone Agent File Validation"
2-
# Validates that the student's agent file has valid YAML frontmatter,
3-
# responsibilities, and guardrails sections
4-
# NOTE: This workflow runs in the accessibility-agents repo, not learning-room
5-
6-
on:
7-
pull_request:
8-
types: [opened, synchronize, reopened]
9-
paths:
10-
- "agents/**/*.md"
11-
- "community-agents/**/*.md"
12-
13-
permissions:
14-
contents: read
15-
pull-requests: write
16-
17-
jobs:
18-
validate-agent:
19-
name: Verify Agent File
20-
runs-on: ubuntu-latest
21-
22-
steps:
23-
- name: Checkout PR branch
24-
uses: actions/checkout@v4
25-
26-
- name: Find and validate agent files
27-
id: check
28-
run: |
29-
# Find new/modified .md files in agents/ or community-agents/
30-
AGENTS=$(find agents community-agents -name '*.md' 2>/dev/null || true)
31-
32-
if [ -z "$AGENTS" ]; then
33-
echo "found=false" >> "$GITHUB_OUTPUT"
34-
exit 0
35-
fi
36-
37-
echo "found=true" >> "$GITHUB_OUTPUT"
38-
FIRST=$(echo "$AGENTS" | head -1)
39-
echo "file=$FIRST" >> "$GITHUB_OUTPUT"
40-
CHECK_FILE="/tmp/capstone-agent.md"
41-
sed '1s/^\xEF\xBB\xBF//' "$FIRST" > "$CHECK_FILE"
42-
43-
ERRORS=""
44-
45-
# Check YAML frontmatter exists (starts with ---)
46-
if head -1 "$CHECK_FILE" | grep -q '^---'; then
47-
echo "has_frontmatter=true" >> "$GITHUB_OUTPUT"
48-
else
49-
echo "has_frontmatter=false" >> "$GITHUB_OUTPUT"
50-
ERRORS="missing YAML frontmatter"
51-
fi
52-
53-
# Check for responsibilities section
54-
if grep -qi '## responsibilities\|## what this agent does' "$CHECK_FILE"; then
55-
echo "has_responsibilities=true" >> "$GITHUB_OUTPUT"
56-
else
57-
echo "has_responsibilities=false" >> "$GITHUB_OUTPUT"
58-
ERRORS="$ERRORS${ERRORS:+, }missing responsibilities section"
59-
fi
60-
61-
# Check for guardrails section
62-
if grep -qi '## guardrails\|## limitations\|## boundaries' "$CHECK_FILE"; then
63-
echo "has_guardrails=true" >> "$GITHUB_OUTPUT"
64-
else
65-
echo "has_guardrails=false" >> "$GITHUB_OUTPUT"
66-
ERRORS="$ERRORS${ERRORS:+, }missing guardrails section"
67-
fi
68-
69-
echo "errors=$ERRORS" >> "$GITHUB_OUTPUT"
70-
71-
- name: Post result
72-
if: always()
73-
uses: actions/github-script@v7
74-
with:
75-
script: |
76-
const found = '${{ steps.check.outputs.found }}' === 'true';
77-
const file = '${{ steps.check.outputs.file }}';
78-
const errors = '${{ steps.check.outputs.errors }}';
79-
let body;
80-
if (!found) {
81-
body = [
82-
'## Challenge 16: No agent file found',
83-
'',
84-
'Create an `.md` file in the `agents/` or `community-agents/` directory ',
85-
'with YAML frontmatter, a responsibilities section, and a guardrails section.',
86-
'',
87-
'See [Chapter 20: Build Your Agent](https://github.com/Community-Access/git-going-with-github/blob/main/docs/20-build-your-agent.md) for the template.'
88-
].join('\n');
89-
} else if (errors) {
90-
body = [
91-
'## Challenge 16: Agent file needs work',
92-
'',
93-
'Found `' + file + '` but it has issues: ' + errors + '.',
94-
'',
95-
'Your agent file should have:',
96-
'- YAML frontmatter (between `---` markers)',
97-
'- A responsibilities/purpose section',
98-
'- A guardrails/limitations section',
99-
].join('\n');
100-
} else {
101-
body = [
102-
'## Challenge 16: Agent file looks great!',
103-
'',
104-
'Found `' + file + '` with valid frontmatter, responsibilities, and guardrails. ',
105-
'Excellent capstone work!'
106-
].join('\n');
107-
}
108-
try {
109-
await github.rest.issues.createComment({
110-
owner: context.repo.owner,
111-
repo: context.repo.repo,
112-
issue_number: context.issue.number,
113-
body
114-
});
115-
} catch (error) {
116-
console.error('Could not post Challenge 16 result:', error.message);
117-
}
Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +0,0 @@
1-
name: "Challenge 7: Merge Conflict Resolution Check"
2-
# Validates that the student resolved all merge conflict markers
3-
4-
on:
5-
pull_request:
6-
types: [opened, synchronize, reopened]
7-
paths:
8-
- "docs/welcome.md"
9-
10-
permissions:
11-
contents: read
12-
pull-requests: write
13-
14-
jobs:
15-
check-conflict-markers:
16-
name: Verify Conflict Resolution
17-
runs-on: ubuntu-latest
18-
19-
steps:
20-
- name: Checkout PR branch
21-
uses: actions/checkout@v4
22-
23-
- name: Check for conflict markers
24-
id: check
25-
run: |
26-
MARKERS=$(grep -rn '<<<<<<< \|======= \|>>>>>>> ' docs/ || true)
27-
if [ -n "$MARKERS" ]; then
28-
echo "found=true" >> "$GITHUB_OUTPUT"
29-
echo "$MARKERS" > /tmp/markers.txt
30-
else
31-
echo "found=false" >> "$GITHUB_OUTPUT"
32-
fi
33-
34-
- name: Check for substantive content
35-
id: content
36-
run: |
37-
LINES=$(wc -l < docs/welcome.md)
38-
if [ "$LINES" -lt 5 ]; then
39-
echo "empty=true" >> "$GITHUB_OUTPUT"
40-
else
41-
echo "empty=false" >> "$GITHUB_OUTPUT"
42-
fi
43-
44-
- name: Post result
45-
if: always()
46-
uses: actions/github-script@v7
47-
with:
48-
script: |
49-
const hasMarkers = '${{ steps.check.outputs.found }}' === 'true';
50-
const isEmpty = '${{ steps.content.outputs.empty }}' === 'true';
51-
let body;
52-
if (hasMarkers) {
53-
body = [
54-
'## Challenge 7: Conflict markers still present',
55-
'',
56-
'Your PR still contains Git conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`). ',
57-
'These need to be removed as part of resolving the merge conflict.',
58-
'',
59-
'**What to do:** Open the file, find the conflict markers, decide which lines to keep, ',
60-
'and delete the marker lines. Then commit and push again.',
61-
'',
62-
'See [Chapter 7: Merge Conflicts](https://github.com/Community-Access/git-going-with-github/blob/main/docs/07-merge-conflicts.md) for help.'
63-
].join('\n');
64-
} else if (isEmpty) {
65-
body = [
66-
'## Challenge 7: File looks empty',
67-
'',
68-
'The conflict was resolved but the file has very little content. ',
69-
'Make sure you kept the lines you intended to keep.',
70-
].join('\n');
71-
} else {
72-
body = [
73-
'## Challenge 7: Conflict resolution looks good!',
74-
'',
75-
'No conflict markers found and the file has substantive content. Well done!'
76-
].join('\n');
77-
}
78-
try {
79-
await github.rest.issues.createComment({
80-
owner: context.repo.owner,
81-
repo: context.repo.repo,
82-
issue_number: context.issue.number,
83-
body
84-
});
85-
} catch (error) {
86-
console.error('Could not post Challenge 7 result:', error.message);
87-
}
Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +0,0 @@
1-
name: "Challenge 10: Local Commit Check"
2-
# Validates that the student made at least one commit on a non-default branch
3-
4-
on:
5-
pull_request:
6-
types: [opened, synchronize, reopened]
7-
branches:
8-
- main
9-
10-
permissions:
11-
contents: read
12-
pull-requests: write
13-
14-
jobs:
15-
check-local-commit:
16-
name: Verify Local Commit Exists
17-
runs-on: ubuntu-latest
18-
19-
steps:
20-
- name: Checkout full history
21-
uses: actions/checkout@v4
22-
with:
23-
fetch-depth: 0
24-
25-
- name: Check branch and commits
26-
id: check
27-
run: |
28-
BRANCH="${{ github.head_ref }}"
29-
if [ "$BRANCH" = "main" ]; then
30-
echo "on_main=true" >> "$GITHUB_OUTPUT"
31-
else
32-
echo "on_main=false" >> "$GITHUB_OUTPUT"
33-
fi
34-
COMMITS=$(git log --oneline origin/main..HEAD | wc -l)
35-
echo "count=$COMMITS" >> "$GITHUB_OUTPUT"
36-
37-
- name: Post result
38-
if: always()
39-
uses: actions/github-script@v7
40-
with:
41-
script: |
42-
const onMain = '${{ steps.check.outputs.on_main }}' === 'true';
43-
const count = parseInt('${{ steps.check.outputs.count }}', 10);
44-
let body;
45-
if (onMain) {
46-
body = [
47-
'## Challenge 10: PR is from the main branch',
48-
'',
49-
'This challenge asks you to create a **feature branch**, make a commit locally, ',
50-
'and push it. Your PR appears to come from main itself.',
51-
'',
52-
'See [Chapter 14: Git in Practice](https://github.com/Community-Access/git-going-with-github/blob/main/docs/14-git-in-practice.md) for branching instructions.'
53-
].join('\n');
54-
} else if (count === 0) {
55-
body = [
56-
'## Challenge 10: No new commits found',
57-
'',
58-
'The branch exists but has no commits ahead of main. ',
59-
'Make sure you committed your changes before pushing.',
60-
].join('\n');
61-
} else {
62-
body = [
63-
'## Challenge 10: Local commit verified!',
64-
'',
65-
'Found ' + count + ' commit(s) on branch `' + '${{ github.head_ref }}' + '`. ',
66-
'Your local Git workflow is working. Well done!'
67-
].join('\n');
68-
}
69-
try {
70-
await github.rest.issues.createComment({
71-
owner: context.repo.owner,
72-
repo: context.repo.repo,
73-
issue_number: context.issue.number,
74-
body
75-
});
76-
} catch (error) {
77-
console.error('Could not post Challenge 10 result:', error.message);
78-
}
Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +0,0 @@
1-
name: "Challenge 14: Issue Template Validation"
2-
# Validates that the student created a custom YAML issue template
3-
4-
on:
5-
pull_request:
6-
types: [opened, synchronize, reopened]
7-
paths:
8-
- ".github/ISSUE_TEMPLATE/**"
9-
10-
permissions:
11-
contents: read
12-
pull-requests: write
13-
14-
jobs:
15-
check-template:
16-
name: Verify Custom Issue Template
17-
runs-on: ubuntu-latest
18-
19-
steps:
20-
- name: Checkout PR branch
21-
uses: actions/checkout@v4
22-
23-
- name: Find and validate template
24-
id: check
25-
run: |
26-
# Look for student-created templates (not our pre-existing ones)
27-
TEMPLATES=$(find .github/ISSUE_TEMPLATE -name '*.yml' \
28-
! -name 'challenge-*.yml' \
29-
! -name 'bonus-*.yml' \
30-
! -name 'config.yml' 2>/dev/null || true)
31-
32-
if [ -z "$TEMPLATES" ]; then
33-
echo "found=false" >> "$GITHUB_OUTPUT"
34-
exit 0
35-
fi
36-
37-
echo "found=true" >> "$GITHUB_OUTPUT"
38-
39-
# Check the first custom template for a name field.
40-
# Normalize a UTF-8 BOM because Windows tooling may add one.
41-
FIRST=$(echo "$TEMPLATES" | head -1)
42-
echo "file=$FIRST" >> "$GITHUB_OUTPUT"
43-
CHECK_FILE="/tmp/custom-issue-template.yml"
44-
sed '1s/^\xEF\xBB\xBF//' "$FIRST" > "$CHECK_FILE"
45-
46-
if grep -q '^name:' "$CHECK_FILE"; then
47-
echo "has_name=true" >> "$GITHUB_OUTPUT"
48-
else
49-
echo "has_name=false" >> "$GITHUB_OUTPUT"
50-
fi
51-
52-
if grep -q '^description:' "$CHECK_FILE"; then
53-
echo "has_desc=true" >> "$GITHUB_OUTPUT"
54-
else
55-
echo "has_desc=false" >> "$GITHUB_OUTPUT"
56-
fi
57-
58-
- name: Post result
59-
if: always()
60-
uses: actions/github-script@v7
61-
with:
62-
script: |
63-
const found = '${{ steps.check.outputs.found }}' === 'true';
64-
const hasName = '${{ steps.check.outputs.has_name }}' === 'true';
65-
const hasDesc = '${{ steps.check.outputs.has_desc }}' === 'true';
66-
const file = '${{ steps.check.outputs.file }}';
67-
let body;
68-
if (!found) {
69-
body = [
70-
'## Challenge 14: No custom template found',
71-
'',
72-
'Create a new `.yml` file in `.github/ISSUE_TEMPLATE/` with at least ',
73-
'a `name:` and `description:` field.',
74-
'',
75-
'See [Chapter 17: Issue Templates](https://github.com/Community-Access/git-going-with-github/blob/main/docs/17-issue-templates.md) for the YAML format.'
76-
].join('\n');
77-
} else if (!hasName || !hasDesc) {
78-
const missing = [];
79-
if (!hasName) missing.push('`name:`');
80-
if (!hasDesc) missing.push('`description:`');
81-
body = [
82-
'## Challenge 14: Template found but missing required fields',
83-
'',
84-
'Found `' + file + '` but it is missing: ' + missing.join(', ') + '.',
85-
'',
86-
'Add the missing fields and push again.'
87-
].join('\n');
88-
} else {
89-
body = [
90-
'## Challenge 14: Custom issue template looks great!',
91-
'',
92-
'Found `' + file + '` with valid `name` and `description` fields. Well done!'
93-
].join('\n');
94-
}
95-
try {
96-
await github.rest.issues.createComment({
97-
owner: context.repo.owner,
98-
repo: context.repo.repo,
99-
issue_number: context.issue.number,
100-
body
101-
});
102-
} catch (error) {
103-
console.error('Could not post Challenge 14 result:', error.message);
104-
}

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

Whitespace-only changes.

0 commit comments

Comments
 (0)