-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 1.83 KB
/
Copy pathclose-develop-issues.yml
File metadata and controls
67 lines (58 loc) · 1.83 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
name: Close Issues Linked from Develop PRs
on:
pull_request:
types: [closed]
permissions:
contents: read
pull-requests: read
issues: write
concurrency:
group: close-develop-issues-${{ github.event.pull_request.number }}
cancel-in-progress: false
jobs:
close-linked-issues:
if: >-
github.repository == 'CKLOB/MUDDA-Server' &&
github.event.pull_request.base.ref == 'develop' &&
github.event.pull_request.merged == true &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
issues: write
steps:
# Always execute the trusted automation code from the default branch.
# Never checkout or execute the closed PR's head branch.
- name: Checkout automation code
uses: actions/checkout@v4
with:
ref: main
persist-credentials: false
- name: Close linked issues
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const path = require('node:path');
const {
closeLinkedIssues,
writeSummary,
} = require(
path.join(
process.env.GITHUB_WORKSPACE,
'.github/scripts/close-develop-issues.js',
),
);
const result = await closeLinkedIssues({
github,
repository: context.payload.repository,
pullRequest: context.payload.pull_request,
});
await writeSummary(core, result);
if (result.failures.length > 0) {
core.setFailed(
`Failed to process ${result.failures.length} linked issue(s).`,
);
}