# This is a basic workflow to help you get started with Actions

name: Project Board Automation

on:
  issues:
    types: [closed, deleted, reopened, opened]

jobs:
  assign-issues-to-projects:
    runs-on: ubuntu-latest
    steps:

    # For bug reports
      - name: New bug issue
        uses: alex-page/github-project-automation-plus@v0.8.1
        if: contains(github.event.issue.labels.*.name, 'bug') && github.event.action == 'opened'
        with:
          project: Bug Reports
          column: To assign
          repo-token: ${{ secrets.PUSH_TOKEN }}
          action: update
          
      - name: Bug issue closed
        uses: alex-page/github-project-automation-plus@v0.8.1
        if: github.event.action == 'closed' || github.event.action == 'deleted'
        with:
          action: delete
          project: Bug Reports
          column: To assign
          repo-token: ${{ secrets.PUSH_TOKEN }}
          
      - name: Bug issue reopened
        uses: alex-page/github-project-automation-plus@v0.8.1
        if: contains(github.event.issue.labels.*.name, 'bug') && github.event.action == 'reopened'
        with:
          project: Bug Reports
          column: To assign
          repo-token: ${{ secrets.PUSH_TOKEN }}
          action: update

      # For feature requests
      - name: New feature issue
        uses: alex-page/github-project-automation-plus@v0.8.1
        if: contains(github.event.issue.labels.*.name, 'enhancement') && github.event.action == 'opened'
        with:
          project: Feature Requests
          column: To assign
          repo-token: ${{ secrets.PUSH_TOKEN }}
          action: update

      - name: Feature request issue closed
        uses: alex-page/github-project-automation-plus@v0.8.1
        if: github.event.action == 'closed' || github.event.action == 'deleted'
        with:
          action: delete
          project: Feature Requests
          column: To assign
          repo-token: ${{ secrets.PUSH_TOKEN }}
          
      - name: Feature request issue reopened
        uses: alex-page/github-project-automation-plus@v0.8.1
        if: contains(github.event.issue.labels.*.name, 'enhancement') && github.event.action == 'reopened'
        with:
          project: Feature Requests
          column: To assign
          repo-token: ${{ secrets.PUSH_TOKEN }}
          action: update