Skip to content

Commit

Permalink
Allow to set commit status context
Browse files Browse the repository at this point in the history
  • Loading branch information
minvs1 committed Oct 26, 2020
1 parent c426949 commit b4951b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Pull number to create status checks for. Default: current pull number.

Name of the check. Default: current job.

### `commit_context`

Context to use for setting commit status for. Default: current job.

## Example usage

```
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ inputs:
check_name:
description: 'Name of the check. Default: current job.'
required: false
commit_context:
description: 'Context to use for setting commit status for. Default: current job.'
required: false

runs:
using: 'node12'
main: 'dist/index.js'
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const owner =
core.getInput("owner") || github.context.payload.repository.owner.login;
const repo = core.getInput("repo") || github.context.payload.repository.name;
const checkName = core.getInput("check_name") || github.context.job;
const commitContext = core.getInput("commit_context") || checkName;

const octokit = github.getOctokit(githubToken);

Expand Down Expand Up @@ -86,7 +87,7 @@ async function createCommitStatus(sha, checkRunID) {
sha,
state,
target_url: `https://github.com/coingate/cicd-test1/runs/${checkRunID}?check_suite_focus=true`,
context: checkName,
context: commitContext,
});
}

Expand Down

0 comments on commit b4951b9

Please sign in to comment.