Skip to content
git-pull-request

GitHub Action

PR Label Check and Comment

v1.0.1 Latest version

PR Label Check and Comment

git-pull-request

PR Label Check and Comment

Checks for required PR label, adds comment and fails PR checks if none of the required labels are provided

Installation

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

              

- name: PR Label Check and Comment

uses: yashhy/[email protected]

Learn more about this action in yashhy/pr-label-check-and-comment-action

Choose a version

PR label check and comment

Checks for required PR label, adds comment and fails PR checks if none of the required labels are provided

What it does?

After a PR is opened, labeled, unlabeled or synchronize, below comment is added if no required labels are found in a PR

Example:

Github bot commenting to add required labels

Example PRs:

Inputs:

  • GITHUB_TOKEN : The GITHUB_TOKEN secret. You can use the default ${{secret.GITHUB_TOKEN}}
  • required_labels : List of required labels for your PRs separated by comma ","

Example: 🕷 bug, 🏆 feature, 📝 docs

Yes, emojis are supported 💪🏻

Example Usage:

Create a file .github/workflows/pr-label-check-and-comment-action.yaml with below contents :

name: Check PR required labels and comment

on:
  pull_request:
    types: [opened, labeled, unlabeled, synchronize]

jobs:
  check-pr-label-and-comment:
    runs-on: ubuntu-latest
    steps:
      - uses: yashhy/pr-label-check-and-comment-action@master
        with:
          required_labels: '🐛bug, 🎖user-story' <-- add your required labels here
          GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'

Build & Release:

  npm i

  npm i -g @vercel/ncc

  ncc build index.js
  1. This op file in dist/index.js
  2. Push all the files
  3. Create a release from GitHub