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

Auto Label Pulls

v0.0.1 Pre-release

Auto Label Pulls

tag

Auto Label Pulls

Automated labeling for Pull Requests based on the target branch

Installation

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

              

- name: Auto Label Pulls

uses: shiftEscape/auto-label-pulls@v0.0.1

Learn more about this action in shiftEscape/auto-label-pulls

Choose a version

Auto-Label Pulls

⚡️🔖 Automates the process of assigning label to your Pull Requests based on a target branch. This action simplifies your project management by automatically categorizing your PRs, enabling you to filter and review them more efficiently.

Features

  • Automatic Label Assignment: Labels are automatically assigned to new pull requests based on the target branch, removing the need for manual labelling.

  • Customizable: You can configure which labels correspond to which branches, allowing you to use in a way that suits your project's needs.

  • Easy to Integrate: Simply add this action to your repository's workflow and it will start working immediately.

Usage

To use, you'll need to add it as a step in your GitHub workflow file i.e (.github/workflows/main.yml), providing the necessary inputs.

name: Workflow Name

on:
  pull_request:
    types: [opened]

jobs:
  label:
    runs-on: ubuntu-latest
    steps:
      ...
      - name: Assign labels based on target branch
        uses: shiftEscape/auto-label-pr@v1.0.0
        with:
          token: "${{ secrets.GITHUB_TOKEN }}"
          config-path: ".github/config/branch-labels.json"

NOTE: Use this action only for pull_request event of type opened.

Configuration

You can configure this by creating a JSON configuration file (i.e .github/config/branch-labels.json) in your repository. In this file, you define the labels that should be added to pull requests for each branch. Here's a sample configuration:

{
  "master": "🚀 Production Deployment",
  "staging": "🚀 UAT Deployment",
  "development": "🚀 SIT Deployment"
}

In the example above, when a Pull Request is made to master, 🚀 Production Deployment label will be assigned to that PR and so on and so forth.