diff --git a/README.md b/README.md index 250b6ec..4dc0ce2 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,10 @@ In order to use this action, you will need to generate a JSON file using the fol **Optional** Ignore if the file which contains annotations is missing. Default: "true". +### `commit` + +**Optional** Commit SHA to which annotations are published. + ## Example usage ```yml diff --git a/action.yml b/action.yml index 4164854..0ce6297 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,9 @@ inputs: description: 'Ignore if the file which contains annotations is missing' required: false default: 'true' + commit: + description: 'Commit SHA to which annotations are published.' + required: false runs: using: 'node16' main: 'dist/index.js' diff --git a/index.js b/index.js index 1671ca3..9e6626e 100644 --- a/index.js +++ b/index.js @@ -139,9 +139,12 @@ async function run () { const title = getInput('title', { required: false }) const octokit = getOctokit(repoToken) + const commitId = getInput('commit', { required: false }} const pullRequest = context.payload.pull_request let ref - if (pullRequest) { + if (commitId) { + ref = commitId + } else if (pullRequest) { ref = pullRequest.head.sha } else { ref = context.sha