name: Sync CCS Backlog Project

on:
  issues:
    types:
      - opened
      - reopened
      - closed
      - labeled
      - unlabeled
  workflow_dispatch:
  schedule:
    - cron: '17 3 * * *'

concurrency:
  group: sync-ccs-backlog-project
  cancel-in-progress: false

permissions:
  contents: read
  issues: read

jobs:
  sync-project:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: '22'

      - name: Sync CCS Backlog project
        env:
          GH_TOKEN: ${{ secrets.CCS_PROJECT_AUTOMATION_TOKEN }}
          CCS_PROJECT_OWNER: kaitranntt
          CCS_PROJECT_NUMBER: '3'
        run: node scripts/github/ccs-backlog-sync.mjs
