Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
tag

GitHub Action

Label Commenter

v1.3.6

Label Commenter

tag

Label Commenter

Label triggered GitHub Actions for posting a template message, automatically close or reopen issues or pull requests

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Label Commenter

uses: peaceiris/actions-label-commenter@v1.3.6

Learn more about this action in peaceiris/actions-label-commenter

Choose a version

license release GitHub release date Release Feed Dependabot Status

Label Commenter GitHub Action

Label Commenter Action

This action is one of label triggered GitHub Actions for posting a template message. After commenting, it can automatically close or reopen issues. Of course, it also can manage pull requests.

This Action was submitted to the GitHub Actions Hackathon and featured by GitHub. (Featured actions from the GitHub Actions Hackathon - The GitHub Blog)

Table of Contents

Table of Contents are generated with DocToc

Getting Started

Create your GitHub Actions workflow file and Label Commenter Action setting file. Commit those and push to the remote master branch.

Workflow Setting

# .github/workflows/label-commenter.yml

name: Label Commenter

on:
  issues:
    types:
      - labeled
      - unlabeled
  pull_request:
    types:
      - labeled
      - unlabeled

jobs:
  comment:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
        with:
          ref: master

      - name: Label Commenter
        uses: peaceiris/actions-label-commenter@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          # config_file: .github/label-commenter-config.yml

For the pull_request event from forks, we need to use a personal access token instead of GITHUB_TOKEN. The generated GITHUB_TOKEN on a fork has no write permission. See the official documentation for more details. Authenticating with the GITHUB_TOKEN - GitHub Help

Action Setting

# .github/label-commenter-config.yml

labels:
  - name: invalid
    labeled:
      issue:
        body: Please follow the issue templates.
        action: close
      pr:
        body: Please follow the pull request templates.
        action: close
    unlabeled:
      issue:
        body: Thank you for following the template. The repository owner will reply.
        action: open
  - name: forum
    labeled:
      issue:
        body: |
          Please ask questions about GitHub Actions at the following forum.
          https://github.community/t5/GitHub-Actions/bd-p/actions
        action: close
  - name: wontfix
    labeled:
      issue:
        body: This will not be worked on but we appreciate your contribution.
        action: close
    unlabeled:
      issue:
        body: This has become active again.
        action: open
  - name: duplicate
    labeled:
      issue:
        body: This issue already exists.
        action: close
  - name: good first issue
    labeled:
      issue:
        body: This issue is easy for contributing. Everyone can work on this.

Examples

Comment and Close Invalid Format Issue or Pull Request

Reopen Issue or Pull Request

Comment and Close Wontfix Issue or Pull Request

Comment and Close Duplicate Issue or Pull Request

Comment Multiple Line

Comment and Close Multiple Issues or Pull Requests

Select Label Labeled

Multiple issues will be closed.

Changelog

License

Maintainer