11name : PR Subscriber
22
33on :
4- workflow_run :
5- workflows : ["PR Receive Label"]
4+ pull_request_target :
65 types :
7- - completed
6+ - labeled
87
98permissions :
10- actions : read
119 contents : read
1210
1311jobs :
1412 auto-subscribe :
1513 runs-on : ubuntu-latest
16- if : >
17- github.repository == 'llvm/llvm-project' &&
18- github.event.workflow_run.event == 'pull_request' &&
19- github.event.workflow_run.conclusion == 'success'
14+ if : github.repository == 'llvm/llvm-project'
2015 steps :
2116 - name : Setup Automation Script
2217 run : |
@@ -26,47 +21,10 @@ jobs:
2621 chmod a+x github-automation.py
2722 pip install -r requirements.txt
2823
29- - name : ' Wait for other actions'
30- # We can't use the concurrency tag for these jobs, because it will
31- # cancel pending jobs if another job is running.
32- env :
33- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
34- run : |
35- python3 pr-subscriber-wait.py
36-
37-
38- # From: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
39- # Updated version here: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
40- - name : ' Download artifact'
41- uses : actions/github-script@v6
42- with :
43- script : |
44- const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
45- owner: context.repo.owner,
46- repo: context.repo.repo,
47- run_id: context.payload.workflow_run.id
48- });
49- const matchArtifact = artifacts.data.artifacts.find((artifact) =>
50- artifact.name === 'pr'
51- );
52- const download = await github.rest.actions.downloadArtifact({
53- owner: context.repo.owner,
54- repo: context.repo.repo,
55- artifact_id: matchArtifact.id,
56- archive_format: 'zip'
57- });
58- const { writeFileSync } = require('node:fs');
59- writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data));
60-
61- - run : unzip pr.zip
62-
6324 - name : Update watchers
64- # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
6525 run : |
66- PR_NUMBER=$(cat NR)
67- LABEL_NAME=$(cat LABEL)
6826 ./github-automation.py \
6927 --token '${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}' \
7028 pr-subscriber \
71- --issue-number "$PR_NUMBER " \
72- --label-name "$LABEL_NAME "
29+ --issue-number "${{ github.event.number }} " \
30+ --label-name "${{ github.event.label.name }} "
0 commit comments