Repository navigation
80 lines (68 loc) · 2.48 KB
/
Copy pathsync-labels.yml
File metadata and controls
80 lines (68 loc) · 2.48 KB
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
73
74
75
76
77
78
79
80
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
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/action-setup@02f6c237bd2518259fed6c71566509edfb3f2b74 # v4
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v4
id: setup-node
with:
node-version-file: 'package.json'
- name: Run github-label-sync
run: |
pnpm dlx github-label-sync@2.2.0 \
--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@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
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@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad
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@e8674b075228eee787fea43ef493e45ece1004c9
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 }}
```