Skip to content

Commit 6ca1abb

Browse files
committed
ci: add step to trigger Airtable update
- Updates Airtable assessment scores
1 parent 6595275 commit 6ca1abb

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/classroom-autograding.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,45 @@ jobs:
326326
core.setOutput('earned', totalEarned);
327327
core.setOutput('available', totalAvailable);
328328
329+
- name: Trigger Airtable update
330+
uses: actions/github-script@v7
331+
env:
332+
GRADING_REPO: ${{ env.GRADING_REPO }}
333+
REPO_URL: ${{ github.repository }}
334+
TEST_SCORE: ${{ steps.get-tests-score.outputs.passed }}
335+
AGENT_SCORE: ${{ steps.get-agent-score.outputs.result }}
336+
with:
337+
github-token: ${{ secrets.CLASSROOM_TOKEN }}
338+
script: |
339+
const [owner, repo] = process.env.GRADING_REPO.split('/');
340+
341+
// Convert agent score from percentage to 0-5 scale
342+
const agentScorePercent = parseInt(process.env.AGENT_SCORE, 10);
343+
const agentScore = Math.round((agentScorePercent / 100) * 5);
344+
345+
// Convert test score to 0-5 scale
346+
const testScore = Math.round((parseInt(process.env.TEST_SCORE, 10) / ${{ env.MAX_TESTS }}) * 5);
347+
348+
// Ensure repository URL has trailing slash
349+
const repoUrl = process.env.REPO_URL.endsWith('/') ? process.env.REPO_URL : `${process.env.REPO_URL}/`;
350+
351+
try {
352+
await github.rest.actions.createWorkflowDispatch({
353+
owner,
354+
repo,
355+
workflow_id: 'update-airtable.yml',
356+
ref: 'main',
357+
inputs: {
358+
test_score: testScore.toString(),
359+
agent_score: agentScore.toString(),
360+
repository_url: repoUrl
361+
}
362+
});
363+
console.log('Successfully triggered Airtable update workflow');
364+
} catch (error) {
365+
core.setFailed(`Failed to trigger Airtable update workflow: ${error.message}`);
366+
}
367+
329368
- name: Post student feedback
330369
uses: actions/github-script@v7
331370
env:

0 commit comments

Comments
 (0)