GitHub Action
Label Commenter
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 are generated with DocToc
Create your GitHub Actions workflow file and Label Commenter Action setting file. Commit those and push to the remote master branch.
# .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
# .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.
Select Label | Labeled |
---|---|
Multiple issues will be closed.