-
-
Notifications
You must be signed in to change notification settings - Fork 777
44 lines (42 loc) · 1.44 KB
/
wr-set-pr-labels.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: WR Set PR Labels
on:
workflow_run:
workflows: ['Set PR Labels']
types: [completed]
jobs:
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The Set PR Labels workflow failed. Please check the logs.'
- run: exit 1
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo 'The Set PR Labels workflow succeeded. The workflow will continue.'
set-pr-labels:
needs: on-success
runs-on: ubuntu-latest
env:
ARTIFACT_NAME: 'pr-labels'
SCRIPT_PATH: './github-actions/trigger-pr/set-pr-labels.js'
steps:
- uses: actions/checkout@v4
- id: download-artifact
name: 'Download artifact'
uses: actions/github-script@v7
with:
script: |
const { downloadLabelsArtifact } = require('${{ env.SCRIPT_PATH }}');
await downloadLabelsArtifact({ github, context }, '${{ env.ARTIFACT_NAME }}');
- id: extract-artifact
name: Extract artifact
run: unzip '${{ env.ARTIFACT_NAME }}.zip'
- id: set-pr-labels
name: 'Set labels on the pull request'
uses: actions/github-script@v7
with:
script: |
const { setLabelsOnPR } = require('${{ env.SCRIPT_PATH }}');
await setLabelsOnPR({ github, context, core }, '${{ env.ARTIFACT_NAME }}.json');