@@ -326,6 +326,45 @@ jobs:
326
326
core.setOutput('earned', totalEarned);
327
327
core.setOutput('available', totalAvailable);
328
328
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
+
329
368
- name : Post student feedback
330
369
uses : actions/github-script@v7
331
370
env :
0 commit comments