Skip to content
check-circle

GitHub Action

Auto create gitmoji labels

v0.1.0 Latest version

Auto create gitmoji labels

check-circle

Auto create gitmoji labels

This action automatically creates gitmoji labels JIT

Installation

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

              

- name: Auto create gitmoji labels

uses: georgepstaylor/[email protected]

Learn more about this action in georgepstaylor/gitmoji-auto-label

Choose a version

gitmoji-auto-label

A simple action to automatically label PRs based on the gitmoji used in the title.

Note: GitHub requires more than just the gitmoji in the title, so this action will create the labels as <gitmoji>_gitmoji for example ✨_gitmoji or πŸ›_gitmoji etc.

Usage

name: Create gitmoji label
on:
  pull_request:
    types: [opened, edited, reopened, synchronize]
jobs:
  create-gitmoji-label:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      contents: read
      repository-projects: read
    steps:
      - name: Enforce gitmoji PR title
        uses: georgepstaylor/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Permissions

The token requires the pull-request: write (to add a label to a PR) and if you are running this in a github-organisation, repository-projects: read too. Please see the following reference for the latter: cli/cli#5307

Using the above example verbatim, you can use the job title gitmoji-pr-title as a required check.

Using this action to assist with GitHub automated release notes

Ensure you set this action job as a required check for your PRs, otherwise PRs could be merged without the correct labels

Optionally you can use this action in conjunction with georgepstaylor/gitmoji-release-action to automatically generate releases and release notes based on the gitmoji labels.

Likewise, you can create releases using the GitHub UI and the release notes will be generated based on the gitmoji labels if you use the following configuration:

See:

# .github/release.yml
changelog:
  exclude:
    labels:
      - ignore-for-release
    authors:
      - octocat
  categories:
    - title: Exciting New Features and Enhancements ✨
      labels:
        - ✨_gitmoji
        - ⚑_gitmoji
        - πŸš€_gitmoji
        - πŸŽ‰_gitmoji
        - πŸ₯š_gitmoji
    - title: Security Fixes πŸ”’
      labels:
        - πŸ”’_gitmoji
        - πŸ›‘οΈ_gitmoji
        - πŸ›‚_gitmoji
        - πŸ”_gitmoji
    - title: Bug Fixes πŸ›
      labels:
        - πŸ›_gitmoji
        - πŸš‘_gitmoji
        - 🩹_gitmoji
    - title: Documentation πŸ“š
      labels:
        - πŸ“š_gitmoji
        - πŸ“_gitmoji
        - πŸ’‘_gitmoji
        - πŸ“„_gitmoji
    - title: Typo Corrections πŸ“
      labels:
        - πŸ“_gitmoji
        - πŸ“š_gitmoji
    - title: Breaking Changes πŸ’₯
      labels:
        - πŸ’₯_gitmoji
    - title: Refactor ♻️
      labels:
        - ♻️_gitmoji
        - ⚰️_gitmoji
        - πŸ—‘οΈ_gitmoji
        - 🚚_gitmoji
    - title: Work In Progress 🚧
      labels:
        - 🚧_gitmoji
        - 🍺_gitmoji
        - πŸ’©_gitmoji
    - title: Dependency Updates πŸ“¦
      labels:
        - βž•_gitmoji
        - βž–_gitmoji
        - πŸ“Œ_gitmoji
        - ⬆️_gitmoji
        - ⬇️_gitmoji
    - title: Other Changes
      labels:
        - "*"