name: 检查歌词提交正确性
on:
  workflow_dispatch:
  issues:
    types: [labeled]
concurrency:
  group: check-submit
  cancel-in-progress: true

jobs:
  check-submit:
    if: github.event.label.name == '歌词提交/补正'
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - name: 签出代码
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: 安装 Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 20
          cache: yarn
          cache-dependency-path: scripts/yarn.lock
      - name: 安装依赖
        run: yarn
        working-directory: scripts
      - name: 运行检查程序
        timeout-minutes: 10
        run: |
          git config --global user.name 'github-actions'
          git config --global user.email 'github-actions@users.noreply.github.com'
          yarn node ./run-submit-check.js
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        working-directory: scripts
