diff --git a/CHANGELOG.md b/CHANGELOG.md index f3bbc08..269de69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.2.0 + +- feat: add outputs `comment-id`. + ## v1.1.0 - feat: add `number`. diff --git a/README.md b/README.md index 2863b86..0b163f0 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ![](https://img.shields.io/github/workflow/status/actions-cool/maintain-one-comment/CI?style=flat-square) [![](https://img.shields.io/badge/marketplace-maintain--one--comment-blueviolet?style=flat-square)](https://github.com/marketplace/actions/maintain-one-comment) +[![](https://img.shields.io/github/v/release/actions-cool/maintain-one-comment?style=flat-square&color=orange)](https://github.com/actions-cool/maintain-one-comment/releases) Maintain just one comment in Issue and PR. @@ -41,6 +42,8 @@ jobs: body-include: '' ``` +### Inputs + | Name | Desc | Type | Required | | -- | -- | -- | -- | | token | GitHub token | string | ✖ | @@ -53,9 +56,14 @@ jobs: - `number`: When no input, it will be the issue or PR number that triggered. When input, it is the highest priority +### Outputs + +- `comment-id`: Return the ID of create or updated comment. + - About `comment-id` use, can refer: https://github.com/actions-cool/issues-helper + ## Note -- When PR come from fork, it requires `pull_request_target`. When use `pull_request_target`, must [read](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target) +- When PR come from fork, it requires `pull_request_target` to comment (Reasons for github built-in permissions). When use `pull_request_target`, must [read](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target) ## Emoji List diff --git a/action.yml b/action.yml index 47f3c67..6f15166 100644 --- a/action.yml +++ b/action.yml @@ -28,6 +28,10 @@ inputs: body-include: description: Comment body filter. +outputs: + comment-id: + description: 'Create or update comment ID' + runs: using: 'node12' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index 5b23377..832afaf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -7113,6 +7113,7 @@ async function run() { body, }); core.info(`Actions: [create-comment][${body}] success!`); + core.setOutput('comment-id', data.id); if (emojis) { dealStringToArr(emojis).forEach(async item => { @@ -7149,6 +7150,7 @@ async function run() { } await octokit.issues.updateComment(params); + core.setOutput('comment-id', commentId); core.info(`Actions: [update-comment][${params.body}] success!`); } else { let length = comments.length; diff --git a/package.json b/package.json index ba34024..7d20e29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "maintain-one-comment", - "version": "1.1.0", + "version": "1.2.0", "private": true, "description": "Maintain just one comment in Issue and PR.", "main": "src/main.js", diff --git a/src/main.js b/src/main.js index 4f89060..ca54e85 100644 --- a/src/main.js +++ b/src/main.js @@ -69,6 +69,7 @@ async function run() { body, }); core.info(`Actions: [create-comment][${body}] success!`); + core.setOutput('comment-id', data.id); if (emojis) { dealStringToArr(emojis).forEach(async item => { @@ -105,6 +106,7 @@ async function run() { } await octokit.issues.updateComment(params); + core.setOutput('comment-id', commentId); core.info(`Actions: [update-comment][${params.body}] success!`); } else { let length = comments.length;