name: Add to project garage

on:
  issues:
    types:
      - opened
      - reopened

permissions: {}

jobs:
  add-to-project:
    permissions:
      repository-projects: write
    secrets:
      SENZING_GITHUB_PROJECT_RW_TOKEN: ${{ secrets.SENZING_GITHUB_PROJECT_RW_TOKEN }}
    uses: senzing-factory/build-resources/.github/workflows/add-to-project.yaml@v3
    with:
      project-number: ${{ vars.SENZING_PROJECT_GARAGE }}
      org: ${{ vars.SENZING_GITHUB_ACCOUNT_NAME }}

  slack-notification:
    needs: [add-to-project]
    if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.add-to-project.outputs.job-status) }}
    secrets:
      SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
    uses: senzing-factory/build-resources/.github/workflows/build-failure-slack-notification.yaml@v3
    with:
      job-status: ${{ needs.add-to-project.outputs.job-status }}
