diff --git a/README.md b/README.md
index ed19cfd..a89c4c4 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,7 @@ You can add this action to your GitHub workflow for Ubuntu runners (e.g. `runs-o
| `multiple-files` | | '' | You can pass array of `json-summary.json` files and generate single comment with table of results
Single line should look like `Title1, ./path/to/json-summary.json` |
| `multiple-junitxml-files` | | '' | You can pass array of `junit.xml` files and generate single comment with table of results
Single line should look like `Title1, ./path/to/junit.xml` |
| `unique-id-for-comment` | | '' | When running in a matrix, pass the matrix value, so each comment will be updated its own comment `unique-id-for-comment: ${{ matrix.node-version }}` |
+| `issue-number` | | '' | Specify the issue number to comment on |
## Output Variables
@@ -77,7 +78,7 @@ You can add this action to your GitHub workflow for Ubuntu runners (e.g. `runs-o
> | Lines | Statements | Branches | Functions |
> | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | ------------ | ---------- |
> | ![Coverage: 78%](https://img.shields.io/badge/Coverage-78%25-yellow.svg)
| 76.74% (33/43) | 33.33% (2/6) | 100% (0/0) |
->
+
> ## My JUnit Title
>
> | Tests | Skipped | Failures | Errors | Time |
diff --git a/action.yml b/action.yml
index 3d08c72..f88ed6a 100644
--- a/action.yml
+++ b/action.yml
@@ -104,6 +104,10 @@ inputs:
default: ''
required: false
+ issue-number:
+ description: 'Specify the issue number to comment on (when triggering the workflow manually)'
+ required: false
+
outputs:
coverage:
description: 'Value indicating the coverage percentage of your report based on Jest, example 78'
diff --git a/src/create-comment.ts b/src/create-comment.ts
index 7161aa9..217fc3e 100644
--- a/src/create-comment.ts
+++ b/src/create-comment.ts
@@ -13,7 +13,7 @@ export async function createComment(
const { repo, owner } = context.repo
const octokit = getOctokit(options.token)
- const issue_number = payload.pull_request ? payload.pull_request.number : 0
+ const issue_number = options.issueNumber || (payload.pull_request ? payload.pull_request.number : 0)
if (body.length > MAX_COMMENT_LENGTH) {
const warningsArr = [
diff --git a/src/index.ts b/src/index.ts
index 2bd2e62..b23a88d 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -59,6 +59,7 @@ async function main(): Promise {
const uniqueIdForComment = core.getInput('unique-id-for-comment', {
required: false,
})
+ const issueNumber = core.getInput('issue-number', { required: false })
const serverUrl = context.serverUrl || 'https://github.com'
core.info(`Uses Github URL: ${serverUrl}`)
@@ -95,6 +96,7 @@ async function main(): Promise {
reportOnlyChangedFiles,
multipleFiles,
multipleJunitFiles,
+ issueNumber: issueNumber ? parseInt(issueNumber) : undefined,
}
if (eventName === 'pull_request' && payload) {
diff --git a/src/types.d.ts b/src/types.d.ts
index c4ee608..b464fb6 100644
--- a/src/types.d.ts
+++ b/src/types.d.ts
@@ -25,6 +25,7 @@ export interface Options {
changedFiles?: ChangedFiles | null
multipleFiles?: string[]
multipleJunitFiles?: string[]
+ issueNumber?: number
}
export interface ChangedFiles {