Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Optional. [Glob](https://github.com/actions/toolkit/tree/master/packages/glob) e

Optional. Check name to use when creating a check run. The default is `Test Report`.

### `commit`

Optional. The commit sha to update the status. This is useful when you run it with `workflow_run`.

## Example usage

```yml
Expand Down
3 changes: 2 additions & 1 deletion action.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const action = async () => {
core.info(`Going to parse results form ${reportPaths}`);
const githubToken = core.getInput('github_token');
const name = core.getInput('check_name');
const commit = core.getInput('commit');

let { count, skipped, annotations } = await parseTestReports(reportPaths);
const foundResults = count > 0 || skipped > 0;
Expand All @@ -19,7 +20,7 @@ const action = async () => {
const link = pullRequest && pullRequest.html_url || github.context.ref;
const conclusion = foundResults && annotations.length === 0 ? 'success' : 'failure';
const status = 'completed';
const head_sha = pullRequest && pullRequest.head.sha || github.context.sha;
const head_sha = commit || pullRequest && pullRequest.head.sha || github.context.sha;
core.info(
`Posting status '${status}' with conclusion '${conclusion}' to ${link} (sha: ${head_sha})`
);
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ inputs:
description: 'check name for test reports'
required: false
default: 'Test Report'
commit:
description: 'commit sha to update the status'
required: false
runs:
using: 'node12'
main: 'dist/index.js'
5 changes: 3 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29751,6 +29751,7 @@ const action = async () => {
core.info(`Going to parse results form ${reportPaths}`);
const githubToken = core.getInput('github_token');
const name = core.getInput('check_name');
const commit = core.getInput('commit');

let { count, skipped, annotations } = await parseTestReports(reportPaths);
const foundResults = count > 0 || skipped > 0;
Expand All @@ -29763,7 +29764,7 @@ const action = async () => {
const link = pullRequest && pullRequest.html_url || github.context.ref;
const conclusion = foundResults && annotations.length === 0 ? 'success' : 'failure';
const status = 'completed';
const head_sha = pullRequest && pullRequest.head.sha || github.context.sha;
const head_sha = commit || pullRequest && pullRequest.head.sha || github.context.sha;
core.info(
`Posting status '${status}' with conclusion '${conclusion}' to ${link} (sha: ${head_sha})`
);
Expand Down Expand Up @@ -30134,4 +30135,4 @@ function authenticate(state, options) {

/***/ })

/******/ });
/******/ });