Skip to content

Commit

Permalink
feat(create-or-update-comment): optional token
Browse files Browse the repository at this point in the history
- Optional token to interact with GitHub API
- Optional comment-author to overwrite github-actions[bot]
  • Loading branch information
NikitaCOEUR authored and neilime committed Feb 9, 2025
1 parent cb2b3de commit fff9053
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
12 changes: 11 additions & 1 deletion actions/create-or-update-comment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ permissions:
# [https://github.com/peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment)
#
reactions: ""

# Description: The comment author. Default is github-actions[bot].
#
comment-author: ""

# Description: Optional token to interact with GitHub API.
# If not defined or empty, the action will use the GITHUB_TOKEN provided by GitHub.
#
token: ""
```
<!-- end usage -->
Expand All @@ -59,7 +68,8 @@ permissions:
| <code>title</code> | The comment title. Must be static and unique, will be used to retrieve the comment if exists already. | | **true** |
| <code>body</code> | The comment body. See [https://github.com/peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) | | **false** |
| <code>reactions</code> | A comma separated list of reactions to add to the comment. See [https://github.com/peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) | | **false** |
| <code>comment-author</code> | The comment author. Default is github-actions[bot]. | github-actions[bot] | **false** |
| <code>token</code> | Optional token to interact with GitHub API. If not defined or empty, the action will use the GITHUB_TOKEN provided by GitHub. | | **false** |
<!-- end inputs -->
<!-- start outputs -->
<!-- end outputs -->
Expand Down
14 changes: 13 additions & 1 deletion actions/create-or-update-comment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ inputs:
reactions:
description: "A comma separated list of reactions to add to the comment. See [https://github.com/peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment)"
required: false
comment-author:
description: "The comment author. Default is github-actions[bot]."
required: false
default: "github-actions[bot]"
token:
description: |
Optional token to interact with GitHub API.
If not defined or empty, the action will use the GITHUB_TOKEN provided by GitHub.
required: false

runs:
using: "composite"
Expand All @@ -36,8 +45,10 @@ runs:
id: find-comment
with:
issue-number: ${{ steps.get-issue-number.outputs.issue-number }}
comment-author: github-actions[bot]
comment-author: ${{ inputs.comment-author }}
body-includes: ${{ inputs.title }}
token: ${{ inputs.token || github.token }}


- uses: peter-evans/create-or-update-comment@v4
with:
Expand All @@ -49,3 +60,4 @@ runs:
${{ inputs.body }}
reactions: ${{ inputs.reactions }}
token: ${{ inputs.token || github.token }}

0 comments on commit fff9053

Please sign in to comment.