name: Check issue template
env:
  YARN_ENABLE_HARDENED_MODE: 0
on:
  issues:
    types: [opened, edited]

jobs:
  main:
    if: ${{ github.repository == 'software-mansion/react-native-svg' && !contains(github.event.issue.labels.*.name, 'Maintainer issue') }}
    runs-on: ubuntu-latest
    concurrency:
      group: needs-more-info-${{ github.event.issue.number }}
      cancel-in-progress: true
    steps:
      - name: Checkout Actions
        uses: actions/checkout@v4
        with:
          repository: 'software-mansion-labs/swmansion-bot'
          ref: stable

      - uses: actions/cache@v3
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

      - name: Install Actions
        run: yarn install

      - name: Needs More Info
        uses: ./needs-more-info
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          needs-more-info-label: 'Missing info'
          required-sections: 'Description;Steps to reproduce;Snack or a link to a repository;SVG version;React Native version;Platforms'
          needs-more-info-response: "Hey! 👋 \n\nIt looks like you've omitted a few important sections from the issue template."
          check-issues-only-created-after: 2024-06-14
          # This action also appends something like: "Please complete X, Y and Z sections." to the response.
          # Code responsible for this can be found here: https://github.com/software-mansion-labs/swmansion-bot/blob/main/needs-more-info/MissingSectionsFormatter.js
