1 name: "Labelling new pull requests"
4 workflows: ["PR Receive"]
11 runs-on: ubuntu-latest
13 github.repository == 'llvm/llvm-project' &&
14 github.event.workflow_run.event == 'pull_request_target' &&
15 github.event.workflow_run.conclusion == 'success'
17 # From: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
18 # Updated version here: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
21 echo "Event: ${{ github.event.workflow_run.event }} Conclusion: ${{ github.event.workflow_run.conclusion }}"
22 - name: 'Download artifact'
23 uses: actions/github-script@v6
26 const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
27 owner: context.repo.owner,
28 repo: context.repo.repo,
29 run_id: context.payload.workflow_run.id
31 const matchArtifact = artifacts.data.artifacts.find((artifact) =>
32 artifact.name === 'pr'
34 const download = await github.rest.actions.downloadArtifact({
35 owner: context.repo.owner,
36 repo: context.repo.repo,
37 artifact_id: matchArtifact.id,
40 const { writeFileSync } = require('node:fs');
41 writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data));
45 - name: "Get PR Number"
48 echo "pr-number=$(cat NR)" >> "$GITHUB_OUTPUT"
50 - uses: actions/labeler@v4
52 configuration-path: .github/new-prs-labeler.yml
53 # workaround for https://github.com/actions/labeler/issues/112
55 repo-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}
56 pr-number: ${{ steps.vars.outputs.pr-number }}