forked from salute-developers/plasma
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 2.16 KB
/
labelling-when-code-review-completed.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
name: Labelling when code review completed
on:
pull_request:
branches:
- dev
jobs:
if: false
labelling:
## if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
show-progress: false
fetch-depth: 0
- name: Prepare environment
uses: ./.github/actions/prepare-environment
- name: Get package name when dirty
id: packages_name
run: |
## jq -c '[.[] | .name]
## Получаем данные в формате ["@salutejs/plasma-new-hope","@salutejs/sdds-cs"]
echo "PACKAGES_NAME=$(npx lerna la --json --since=$(git merge-base --fork-point origin/dev) --exclude-dependents | jq -c '[.[] | .name]')" >> "$GITHUB_OUTPUT"
- name: Add label
id: data
uses: actions/github-script@v7
env:
DATA: ${{ steps.packages_name.outputs.PACKAGES_NAME }}
with:
script: |
const data = JSON.parse(process.env.DATA || []) ;
if (!data.length) {
console.log('Empty state');
return '';
}
const labels = data
.map((item) => item.replace('@salutejs/', ''))
.map((item) => {
if (item === 'plasma-new-hope') {
return 'core';
}
return item;
});
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels,
})