forked from hackforla/website
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (44 loc) · 1.57 KB
/
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
45
46
name: Set PR Labels
on:
pull_request:
types: [opened, edited]
branches:
- 'gh-pages'
- 'feature-homepage-launch'
jobs:
generate-labels-artifact:
runs-on: ubuntu-latest
env:
ARTIFACT_DIR: './set-pr-labels/artifacts'
ARTIFACT_FILE: 'pr-labels.json'
PR_NUMBER: ${{ github.event.number }}
SCRIPT_PATH: './github-actions/trigger-pr/set-pr-labels.js'
steps:
- uses: actions/checkout@v4
- id: parse-pr-body
name: 'Parse the pull request body for all linked issues'
uses: actions/github-script@v7
with:
script: |
const { listIssuesFromPRBody } = require('${{ env.SCRIPT_PATH }}');
return listIssuesFromPRBody({ context, core });
- id: compile-labels
name: 'Compile labels from linked issues'
uses: actions/github-script@v7
with:
script: |
const { listLabelsFromIssues } = require('${{ env.SCRIPT_PATH }}');
const issues = ${{ steps.parse-pr-body.outputs.result }};
return await listLabelsFromIssues({ github, context, core }, issues);
- id: save-labels
name: 'Save labels'
run: |
mkdir -p '${{ env.ARTIFACT_DIR }}'
echo ${{ steps.compile-labels.outputs.result }} > '${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_FILE }}'
- id: upload-labels-artifact
name: 'Upload labels artifact'
uses: actions/upload-artifact@v4
with:
name: pr-labels
path: '${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_FILE }}'
retention-days: 1