forked from WeblateOrg/weblate
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (63 loc) · 2.55 KB
/
issue-closed.yml
File metadata and controls
71 lines (63 loc) · 2.55 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
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: CC0-1.0
#
# Issue lifecycle: Add "Waiting for: Release" label when resolving an issue
name: 'Issues: Mark resolved issue'
on:
issues:
types: [closed]
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.state_reason == 'completed' && 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: Release']
})
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `
Thank you for your report — the issue has now been resolved.
The fix has been merged into the repository and will be included in the upcoming Weblate ${context.payload.issue.milestone.title} release.
* If you encounter any issues with the fix, please comment in this thread.
* If you experience a similar but separate issue, open a new report so we can track it properly.
* If you find Weblate helpful, consider [supporting its development](https://weblate.org/donate/).
`
})
}