name: Label Issues

on:
  issues:
    types: [opened]
permissions:
  issues: write
jobs:
  label:
    runs-on: ubuntu-latest

    steps:
      - name: Check if issue opener is ZooSpiritWolf
        id: check_opener
        uses: actions/github-script@v7
        with:
          script: |
            const issueOpener = context.payload.issue.user.login;
            return issueOpener === 'ZooSpiritWolf';

      - name: Add labels
        if: steps.check_opener.outputs.result == 'true'
        uses: actions/github-script@v7
        with:
          script: |
            github.issues.addLabels({
              owner: context.repo.owner,
              repo: context.repo.repo,
              issue_number: context.payload.issue.number,
              labels: ['bug', 'regression', 'high-priority']
            });
