name: 🔖 Sync Roadmap Labels

on:
  push:
    paths:
      - '.github/roadmap-labels.yml'
      - 'scripts/sync-roadmap-labels.js'
  workflow_dispatch:

permissions:
  issues: write
  contents: read

jobs:
  sync-labels:
    runs-on: ubuntu-latest
    name: Sync Labels from Roadmap Config

    steps:
      - name: 📥 Checkout repo
        uses: actions/checkout@v4

      - name: 🛠 Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: 'npm'

      - name: 📦 Install dependencies
        run: npm ci

      - name: 🔖 Run label sync script
        run: node scripts/sync-roadmap-labels.js
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
