Skip to content

Commit

Permalink
chore: fix debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ImLunaHey committed Mar 1, 2024
1 parent 690a6c1 commit 99c6434
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
11 changes: 10 additions & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,17 @@ describe('action', () => {

// Verify that all of the core library functions were called correctly
expect(debugMock).toHaveBeenNthCalledWith(1, 'Sending annotation to Axiom')
expect(debugMock).toHaveBeenNthCalledWith(
2,
`Annotation: ${JSON.stringify({
datasets: ['test-dataset'],
title: 'test title',
description: 'This is a test',
url: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
})}`
)
expect(setFailedMock).not.toHaveBeenCalled()
expect(debugMock).toHaveBeenNthCalledWith(2, 'Annotation sent to Axiom')
expect(debugMock).toHaveBeenNthCalledWith(3, 'Annotation sent to Axiom')
expect(errorMock).not.toHaveBeenCalled()
})

Expand Down
7 changes: 6 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ export async function run(): Promise<void> {
}

// Log the annotation details
core.debug(`Annotation: ${JSON.stringify(body)}`)
core.debug(
`Annotation: ${JSON.stringify({
datasets,
title,
description,
url
})}`
)

// Send the annotation to Axiom
const response = await fetch('https://api.axiom.co/v2/annotations', {
Expand Down

0 comments on commit 99c6434

Please sign in to comment.