# Labels new issues by their title. The title is pasted into the shell script.
name: Label issues

on:
  issues:
    types: [opened]

permissions:
  issues: write

jobs:
  label:
    runs-on: ubuntu-latest
    steps:
      - name: Pick a label
        run: |
          title="${{ github.event.issue.title }}"
          if [[ "$title" == *crash* ]]; then
            gh issue edit ${{ github.event.issue.number }} --add-label bug --repo "$GITHUB_REPOSITORY"
          fi
        env:
          GH_TOKEN: ${{ github.token }}
