Skip to content

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

License

Notifications You must be signed in to change notification settings

Shresht7/label-sync-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Label Sync

Release License

GitHub Action to create, update, and delete labels from your repository declaratively

Test Validate Action Readme

Table of Contents

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published