name: Auto Assign Project Local

on:
  issues:
    types: [labeled]
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
  assign_one_project:
    runs-on: ubuntu-latest
    name: Assign to One Project
    steps:
    - name: Run issues assignment to project SIG Runtime Kanban
      uses: srggrs/assign-one-project-github-action@1.2.0
      if: |
        contains(github.event.issue.labels.*.name, 'component/executor') ||
        contains(github.event.issue.labels.*.name, 'component/expression')
      with:
        project: 'https://github.com/pingcap/tidb/projects/38'
        column_name: 'Issue Backlog: Need Triage'
    - name: Run issues assignment to project SIG Planner Kanban
      uses: srggrs/assign-one-project-github-action@1.2.0
      if: |
        contains(github.event.issue.labels.*.name, 'component/planner') ||
        contains(github.event.issue.labels.*.name, 'component/statistics')
      with:
        project: 'https://github.com/pingcap/tidb/projects/39'
        column_name: 'Issue Backlog: Need Triage'
    - name: Run issues assignment to Question and Bug Reports Kanban
      uses: srggrs/assign-one-project-github-action@1.2.0
      if: |
        contains(github.event.issue.labels.*.name, 'type/question') ||
        contains(github.event.issue.labels.*.name, 'type/bug')
      with:
        project: 'https://github.com/pingcap/tidb/projects/36'
        column_name: 'Need Triage'
    - name: Run issues assignment to Feature Request Kanban
      uses: srggrs/assign-one-project-github-action@1.2.0
      if: |
        contains(github.event.issue.labels.*.name, 'type/feature-request')
      with:
        project: 'https://github.com/pingcap/tidb/projects/41'
        column_name: 'Need Triage'
    - name: Run issues assignment to Robust test
      uses: srggrs/assign-one-project-github-action@1.2.0
      if: |
        contains(github.event.issue.labels.*.name, 'component/test')
      with:
        project: 'https://github.com/pingcap/tidb/projects/32'
        column_name: 'TODO/Help Wanted'
    - name: Run issues assignment to project UT Coverage
      uses: srggrs/assign-one-project-github-action@1.2.0
      if: |
        contains(github.event.issue.labels.*.name, 'type/UT-coverage')
      with:
        project: 'https://github.com/pingcap/tidb/projects/44'
        column_name: 'To do'
