Skip to content

Commit

Permalink
Add 'conclusion' output parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Dorner committed Nov 18, 2020
1 parent 651a2e1 commit 1ee2707
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ jobs:
name: 'JEST Tests'
path: '__tests__/__results__/jest-junit.xml'
reporter: 'jest-junit'
- name: 'Sanity check' # re-run tests in case this action failed to detected failing test
- name: 'Sanity check' # re-run tests in case this action failed to detect failing test
run: npm test
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ inputs:
description: 'GitHub Access Token'
required: false
default: ${{ github.token }}
outputs:
conclusion:
description: |
Final conclusion of the created check run:
- 'success' if no failed tests was found
- 'failure' if any failed test was found
runs:
using: 'node12'
main: 'dist/index.js'
21 changes: 13 additions & 8 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ async function main(): Promise<void> {
const parser = getParser(reporter)
const content = getFileContent(path)
const result = await parser(content)
const conclusion = result.success ? 'success' : 'failure'

await octokit.checks.create({
head_sha: sha,
name,
conclusion,
status: 'completed',
conclusion: result.success ? 'success' : 'failure',
output: result.output,
...github.context.repo
})

core.setOutput('conclusion', conclusion)
}

function getParser(reporter: string): ParseTestResult {
Expand Down

0 comments on commit 1ee2707

Please sign in to comment.