dessant / reaction-comments

πŸ‘ πŸ“¨ πŸ’” GitHub Action that deletes +1 comments

Home Page:https://github.com/marketplace/actions/reaction-comments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reaction Comments

Reaction Comments is a GitHub Action that deletes reaction comments, such as +1, and encourages the use of GitHub reactions.

Supporting the Project

The continued development of Reaction Comments is made possible thanks to the support of awesome backers. If you'd like to join them, please consider contributing with Patreon, PayPal or Bitcoin.

How It Works

The action detects if new or edited comments consist solely of emojis and shortcodes used in GitHub reactions. Matching comments are replaced with the message set in issue-comment or pr-comment, and deleted after a day. When the issue-comment or pr-comment parameter is set to '', matching comments are immediately deleted.

Usage

Create the reaction-comments.yml workflow file in the .github/workflows directory, use one of the example workflows to get started.

Inputs

The action can be configured using input parameters.

  • github-token
    • GitHub access token, value must be ${{ github.token }} or an encrypted secret that contains a personal access token
    • Optional, defaults to ${{ github.token }}
  • exempt-issue-labels
    • Do not process comments on issues with any of these labels, value must be a comma separated list of labels
    • Optional, defaults to ''
  • issue-comment
    • Replace reaction comments on issues with this message, {comment-author} is an optional placeholder
    • Optional, defaults to :wave: @{comment-author}, would you like to leave a reaction instead?
  • exempt-pr-labels
    • Do not process comments on pull requests with any of these labels, value must be a comma separated list of labels
    • Optional, defaults to ''
  • pr-comment
    • Replace reaction comments on pull requests with this message, {comment-author} is an optional placeholder
    • Optional, defaults to :wave: @{comment-author}, would you like to leave a reaction instead?
  • process-only
    • Process comments only on issues or pull requests, value must be either issues or prs
    • Optional, defaults to ''
  • log-output
    • Log output parameters, value must be either true or false
    • Optional, defaults to false

Outputs

  • comments
    • Comments that have been either deleted or scheduled for removal, value is a JSON string in the form of [{"owner": "actions", "repo": "toolkit", "issue_number": 1, "comment_id": 754701878, "is_review_comment": false, "status": "deleted"}], value of status is either scheduled or deleted
    • Defaults to ''

Examples

The following workflow will replace new or edited reaction comments with a helpful message, and delete them after a day.

name: 'Reaction Comments'

on:
  issue_comment:
    types: [created, edited]
  pull_request_review_comment:
    types: [created, edited]
  schedule:
    - cron: '0 0 * * *'

permissions:
  actions: write
  issues: write
  pull-requests: write

jobs:
  action:
    runs-on: ubuntu-latest
    steps:
      - uses: dessant/reaction-comments@v4

Available input parameters

This workflow declares all the available input parameters of the action and their default values. Any of the parameters can be omitted.

name: 'Reaction Comments'

on:
  issue_comment:
    types: [created, edited]
  pull_request_review_comment:
    types: [created, edited]
  schedule:
    - cron: '0 0 * * *'

permissions:
  actions: write
  issues: write
  pull-requests: write

jobs:
  action:
    runs-on: ubuntu-latest
    steps:
      - uses: dessant/reaction-comments@v4
        with:
          github-token: ${{ github.token }}
          exempt-issue-labels: ''
          issue-comment: >
            :wave: @{comment-author}, would you like to leave
            a reaction instead?
          exempt-pr-labels: ''
          pr-comment: >
            :wave: @{comment-author}, would you like to leave
            a reaction instead?
          process-only: ''
          log-output: false

Ignoring comments

This step will process comments only on issues, and ignore threads with the the help or party-parrot labels applied.

    steps:
      - uses: dessant/reaction-comments@v4
        with:
          exempt-issue-labels: 'help, party-parrot'
          process-only: 'issues'

This step will process comments only on pull requests, and ignore threads with the pinned label applied.

    steps:
      - uses: dessant/reaction-comments@v4
        with:
          exempt-pr-labels: 'pinned'
          process-only: 'prs'

Deleting comments

By default, reaction comments are replaced with a message and deleted after a day. This step will immediately delete new or edited reaction comments on issues and pull requests.

    steps:
      - uses: dessant/reaction-comments@v4
        with:
          issue-comment: ''
          pr-comment: ''

Using a personal access token

The action uses an installation access token by default to interact with GitHub. You may also authenticate with a personal access token to perform actions as a GitHub user instead of the github-actions app.

Create a personal access token with the repo or public_repo scopes enabled, and add the token as an encrypted secret for the repository or organization, then provide the action with the secret using the github-token input parameter.

    steps:
      - uses: dessant/reaction-comments@v4
        with:
          github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

License

Copyright (c) 2018-2023 Armin Sebastian

This software is released under the terms of the MIT License. See the LICENSE file for further information.

About

πŸ‘ πŸ“¨ πŸ’” GitHub Action that deletes +1 comments

https://github.com/marketplace/actions/reaction-comments

License:MIT License


Languages

Language:JavaScript 100.0%