-
Notifications
You must be signed in to change notification settings - Fork 1.5k
37 lines (34 loc) · 1.05 KB
/
milestone-add-to-pr.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
# This action adds the "next release" milestone to a pull request
# when it is merged
name: "Project: Add PR to Milestone"
on:
pull_request_target:
types:
- closed
permissions: read-all
jobs:
update-pr:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const milestones = await github.rest.issues.listMilestones({
owner: context.repo.owner,
repo: context.repo.repo,
state: "open"
})
for (const milestone of milestones.data) {
if (milestone.title == "next release") {
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
milestone: milestone.number
});
return
}
}