Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
test logging'
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishkeshan committed Dec 6, 2023
1 parent cacf9d4 commit 7916542
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/notify-classroom.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ exports.NotifyClassroom = async function NotifyClassroom (runnerResults) {

return acc
}, { totalScore: 0, maxScore: 0 })
console.log(`Total points: ${totalScore}/${maxScore}`)
if (!maxScore) return

// Our action will need to API access the repository so we require a token
// This will need to be set in the calling workflow, otherwise we'll exit
const token = process.env.GITHUB_TOKEN || core.getInput('token')
console.log(`Token: ${token}`)
if (!token || token === '') return

// Create the octokit client
const octokit = github.getOctokit(token)
console.log(`Octokit: ${octokit}`)
if (!octokit) return

// The environment contains a variable for current repository. The repository
Expand All @@ -35,6 +38,7 @@ exports.NotifyClassroom = async function NotifyClassroom (runnerResults) {

// We need the workflow run id
const runId = parseInt(process.env.GITHUB_RUN_ID || '')
console.log(`Run ID: ${runId}`)
if (Number.isNaN(runId)) return

// List check runs for the repository
Expand All @@ -46,7 +50,7 @@ exports.NotifyClassroom = async function NotifyClassroom (runnerResults) {

// Filter to find the check run named "Autograding Tests" for the specific workflow run ID
const checkRun = checkRunsResponse.data.check_runs.find(cr => cr.name === 'Autograding Tests' && cr.check_suite.workflow_run_id === runId)

console.log(`Check run: ${checkRun}`)
if (!checkRun) return

// Update the checkrun, we'll assign the title, summary and text even though we expect
Expand Down

0 comments on commit 7916542

Please sign in to comment.