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 default branch.
# .github/workflows/label-commenter.yml
name: Label Commenter
on:
issues:
types:
- labeled
- unlabeled
pull_request_target:
types:
- labeled
- unlabeled
jobs:
comment:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
ref: main
- name: Label Commenter
uses: peaceiris/actions-label-commenter@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# config_file: .github/label-commenter-config.yml
# .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/c/github-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.
- name: proposal
labeled:
issue:
body: |
Thank you @{{ issue.user.login }} for suggesting this.
Authenticating with the GITHUB_TOKEN - GitHub Docs
When you use the repository's
GITHUB_TOKEN
to perform tasks on behalf of the GitHub Actions app, events triggered by theGITHUB_TOKEN
will not create a new workflow run. This prevents you from accidentally creating recursive workflow runs. For example, if a workflow run pushes code using the repository'sGITHUB_TOKEN
, a new workflow will not run even when the repository contains a workflow configured to run when push events occur.
You need to provide a personal access token to an auto label GitHub Actions or GitHub Bot like actions/labeler
.
Select Label | Labeled |
---|---|
Multiple issues will be closed.