name: Label Sync

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

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  sync-labels:
    name: Sync Labels
    runs-on: ubuntu-latest
    permissions:
      contents: read
      issues: write
    steps:
      - name: Checkout code
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
        with:
          persist-credentials: false

      - name: Sync labels
        uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2.3.3
        with:
          config-file: .github/labels.yml
          delete-other-labels: false
          token: ${{ secrets.GITHUB_TOKEN }}

