-
-
Notifications
You must be signed in to change notification settings - Fork 2k
49 lines (46 loc) · 1.6 KB
/
Copy pathv3-label-automation.yml
File metadata and controls
49 lines (46 loc) · 1.6 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
name: Assign v3 project and milestone
on:
issues:
types:
- labeled
pull_request_target:
types:
- labeled
permissions:
contents: read
issues: write
pull-requests: write
jobs:
assign-v3:
if: ${{ github.event.label && github.event.label.name == 'v3' }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Add item to v3 project
uses: actions/add-to-project@5afcf98fcd03f1c2f92c3c83f58ae24323cc57fd # v2.0.0
with:
project-url: https://github.com/orgs/gofiber/projects/1
github-token: ${{ secrets.ISSUE_PR_TOKEN }}
- name: Assign v3 milestone
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ secrets.ISSUE_PR_TOKEN }}
script: |
const payload = context.eventName === 'issues' ? context.payload.issue : context.payload.pull_request;
const issueNumber = payload.number;
const milestones = await github.paginate(github.rest.issues.listMilestones, {
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
per_page: 100,
});
const milestone = milestones.find((item) => item.title === 'v3');
if (!milestone) {
throw new Error('Milestone "v3" was not found.');
}
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
milestone: milestone.number,
});