-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
72 lines (63 loc) · 2.3 KB
/
sync-labels.yml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: meta(labels)
on:
pull_request:
paths:
- .github/labels.yml
push:
branches:
- master
paths:
- .github/labels.yml
# hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
jobs:
sync:
name: syncs repository labels
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- uses: getsentry/action-setup-volta@c52be2ea13cfdc084edb806e81958c13e445941e # v1.2.0
- name: Install github-label-sync
run: yarn global add [email protected]
- name: Run github-label-sync
run: |
github-label-sync \
--access-token ${{ secrets.GITHUB_TOKEN }} \
--labels .github/labels.yml \
${{ github.event_name == 'pull_request' && '--dry-run' || '' }} \
${{ github.repository }} \
2>&1 | tee sync-report.txt
- name: Read sync output into variable
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
if: github.event_name == 'pull_request'
id: github-label-sync
with:
script: |
const fs = require('fs');
return fs.readFileSync('sync-report.txt','utf8').toString();
result-encoding: string
- name: Find previous dry-run comment
uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1
if: github.event_name == 'pull_request'
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- LABELS_UPDATE -->'
- name: Add or update dry-run comment
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2
if: github.event_name == 'pull_request'
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: >
<!-- LABELS_UPDATE -->
🏷 The following changes will be made to the repository labels
```
${{ steps.github-label-sync.outputs.result }}
```