1name: Issue Subscriber
2
3on:
4  issues:
5    types:
6      - labeled
7
8jobs:
9  auto-subscribe:
10    runs-on: ubuntu-latest
11    if: github.repository == 'llvm/llvm-project'
12    steps:
13      - name: Setup Automation Script
14        run: |
15          curl -O -L https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA/llvm/utils/git/github-automation.py
16          curl -O -L https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA/llvm/utils/git/requirements.txt
17          chmod a+x github-automation.py
18          pip install -r requirements.txt
19
20      - name: Update watchers
21        # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
22        env:
23          LABEL_NAME: ${{ github.event.label.name }}
24        run: |
25          ./github-automation.py \
26            --token '${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}' \
27            issue-subscriber \
28            --issue-number '${{ github.event.issue.number }}' \
29            --label-name "$LABEL_NAME"
30