1name: Label PRs & Issues
 2# Note for maintainers: Don't add labels that can be abused
 3
 4on:
 5  issue_comment:                                     
 6    types: [ created ]
 7
 8jobs:
 9  build:
10    if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/build') }}
11    runs-on: ubuntu-latest
12    permissions:
13      issues: write
14      pull-requests: write
15    steps:
16      - run: gh issue edit "$NUMBER" --add-label "$LABELS"
17        env:
18          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19          GH_REPO: ${{ github.repository }}
20          NUMBER: ${{ github.event.issue.number }}
21          LABELS: auto-build
22  test:
23    if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/test') }}
24    runs-on: ubuntu-latest
25    permissions:
26      issues: write
27      pull-requests: write
28    steps:
29      - run: gh issue edit "$NUMBER" --add-label "$LABELS"
30        env:
31          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32          GH_REPO: ${{ github.repository }}
33          NUMBER: ${{ github.event.issue.number }}
34          LABELS: auto-test