diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a3430a..f3bbc08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.1.0 + +- feat: add `number`. + ## v1.0.0 `2021.02.18` diff --git a/README.md b/README.md index b7d0c2e..c4bccff 100644 --- a/README.md +++ b/README.md @@ -44,12 +44,15 @@ jobs: | Name | Desc | Type | Required | | -- | -- | -- | -- | | token | GitHub token | string | ✖ | +| number | Manually control the issue or PR number | string | ✖ | | body | Create comment body | string | ✔ | | emojis | Add [emoji](#emoji-list) | string | ✖ | | update-mode | Comment update mode. Options: `replace` `append`. Default: `replace` | string | ✖ | | comment-auth | Filter comment auth | string | ✖ | | body-include | Filter comment body | string | ✖ | +- `number`: When no input, it will be the issue or PR number that triggered. When input, it is the highest priority + ## Emoji List | input | emoji | diff --git a/action.yml b/action.yml index cea770e..47f3c67 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,8 @@ inputs: required: true emojis: description: Add emojis to comment. + number: + description: Manually control the issue or PR number update-mode: description: Update comment mode. Default replace. Option append. comment-auth: diff --git a/dist/index.js b/dist/index.js index ea7d905..5b23377 100644 --- a/dist/index.js +++ b/dist/index.js @@ -7069,14 +7069,19 @@ async function run() { const commentAuth = core.getInput('comment-auth'); const bodyInclude = core.getInput('body-include'); + // 手动 number + const inputNumber = core.getInput('number'); + let number; - if (context.eventName.includes('issue')) { + if (inputNumber) { + number = inputNumber; + } else if (context.eventName.includes('issue')) { number = context.payload.issue.number; } else if (context.eventName.includes('pull_request')) { number = context.payload.pull_request.number; } else { core.info( - `Now eventName: ${context.eventName}. This Action only support issue and pull_request related!`, + `Now eventName: ${context.eventName}. And input number is empty. This Action only support issue and pull_request related!`, ); return false; } diff --git a/src/main.js b/src/main.js index 49ac7f5..4f89060 100644 --- a/src/main.js +++ b/src/main.js @@ -25,14 +25,19 @@ async function run() { const commentAuth = core.getInput('comment-auth'); const bodyInclude = core.getInput('body-include'); + // 手动 number + const inputNumber = core.getInput('number'); + let number; - if (context.eventName.includes('issue')) { + if (inputNumber) { + number = inputNumber; + } else if (context.eventName.includes('issue')) { number = context.payload.issue.number; } else if (context.eventName.includes('pull_request')) { number = context.payload.pull_request.number; } else { core.info( - `Now eventName: ${context.eventName}. This Action only support issue and pull_request related!`, + `Now eventName: ${context.eventName}. And input number is empty. This Action only support issue and pull_request related!`, ); return false; }