forked from WeblateOrg/weblate
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (58 loc) · 2.02 KB
/
issue-reopened.yaml
File metadata and controls
64 lines (58 loc) · 2.02 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
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: CC0-1.0
#
# Issue lifecycle: Add "Waiting for: Implementation" label when reopening an issue
name: 'Issues: Mark reopened issue'
on:
issues:
types: [reopened]
permissions:
contents: read
concurrency:
# Avoid double execution as this can be triggered from commit and pull request
# causing two closing events being delivered to the issue.
group: ${{ github.workflow }}-${{ github.event.issue.id }}
cancel-in-progress: true
jobs:
apply-label:
permissions:
issues: write
runs-on: ubuntu-24.04
if: '! github.event.issue.pull_request'
steps:
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const labels = await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
for (const label of labels.data) {
if (label.name.startsWith('Waiting for: ')) {
console.log(`Removing label ${label.name}`);
await github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
})
}
}
console.log(context.payload);
if ( context.payload.issue.milestone && context.payload.issue.milestone.state == 'open') {
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Waiting for: Implementation']
})
} else {
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Waiting for: Triage']
})
}