label-sync-action

GitHub Action to synchronize and manage your repository's labels 🏷

MIT License

Stars
1
Committers
3

You can create, update and delete labels declaratively by editing a config-file.

📑 Permissions

This action needs the GITHUB_TOKEN secret to use the GitHub API in order to modify labels.

📖 Usage

Create a workflow file (e.g. .github/workflows/label-sync.yaml) and configure the input parameters.

# ============================================
#                   LABEL-SYNC
# --------------------------------------------
# GitHub Action to manage labels declaratively
# ============================================

name: Label Sync

# Activation Events
# =================

on:
  # When .github/labels.yml changes are pushed to the default branch
  push:
    branches:
      - main
    paths:
      - .github/labels.yml

  # When a workflow event is dispatched manually
  workflow_dispatch:

# Jobs
# ====

jobs:
  label-sync:
    runs-on: ubuntu-latest
    name: Label Sync
    steps:
      # Actions/Checkout
      # ================

      - name: Checkout
        uses: actions/checkout@v4

      # Execute label-sync action
      # =========================

      - name: label-sync
        uses: Shresht7/label-sync-action@main
        id: label-sync
        with:
          dryrun: false # Will not make any actual changes if true (default: true)
          create: true # If true, label-sync has permissions to create labels (default: true)
          update: true # If true, label-sync has permissions to update labels (default: true)
          delete: false # If true, label-sync has permissions to delete labels (default: false)
        env:
          # Needed to make use of the GitHub API to modify labels and update .github/labels.yml file
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

NOTE: Potential changes will only be logged if dry run is true. For label-sync to actually modify anything you will have to set dryrun to false.

Example Config

The config file (.github/labels.yaml) will look something like this:

- name: bug
  color: ee1111
  description: Something isn't working

- name: documentation
  color: 0e8a16
  description: Improvements or additions to the documentation

- name: enhancement
  color: a2eeef
  description: New feature or request

NOTE: If you're prefixing colors with a # then wrap them with quotation marks (like '#ffffff') or yaml will think anything following the # is a comment.

📋 Inputs

Input Description Default Required
config Path to the files containing the label configurations. (Can be URLs) .github/labels.yml
create If true, label-sync has permission to create labels true
update If true, label-sync has permission to update labels true
delete If true, label-sync has permission to delete labels false
dryrun Dry-run toggle. label-sync will not make any actual changes if true true

📑 License

MIT License

Package Rankings
Top 22.58% on Github actions
Badges
Extracted from project README's
Release License Test Validate Action Readme
Related Projects