name: Label Sync

on:
  push:
    branches:
      - main
    paths:
      - '.github/labels.yml'
      - '.github/workflows/label-sync.yml'
  workflow_dispatch:

permissions:
  contents: read
  issues: write

jobs:
  sync:
    name: Sync labels to GitHub
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5  # v4.3.1

      - name: Sync labels
        uses: crazy-max/ghaction-github-labeler@548a7c3603594ec17c819e1239f281a3b801ab4d  # v6.0.0
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          yaml-file: .github/labels.yml
          dry-run: false
          skip-delete: false
