Commit 76daf98 1 parent 84b637a commit 76daf98 Copy full SHA for 76daf98
File tree 1 file changed +60
-0
lines changed
1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ # shamelessly copied from https://github.com/sigstore/cosign/blob/main/.github/workflows/milestone.yaml
2
+
3
+ name : milestone
4
+
5
+ on :
6
+ pull_request_target :
7
+ types : [closed]
8
+ branches :
9
+ - main
10
+
11
+ jobs :
12
+ milestone :
13
+ runs-on : ubuntu-latest
14
+
15
+ permissions :
16
+ actions : none
17
+ checks : none
18
+ contents : read
19
+ deployments : none
20
+ issues : write
21
+ packages : none
22
+ pull-requests : write
23
+ repository-projects : none
24
+ security-events : none
25
+ statuses : none
26
+
27
+ steps :
28
+ - uses : actions/github-script@v7 # v6
29
+ with :
30
+ github-token : ${{ secrets.BOT_GITHUB_TOKEN }}
31
+ script : |
32
+ if (!context.payload.pull_request.merged) {
33
+ console.log('PR was not merged, skipping.');
34
+ return;
35
+ }
36
+
37
+ if (!!context.payload.pull_request.milestone) {
38
+ console.log('PR has existing milestone, skipping.');
39
+ return;
40
+ }
41
+
42
+ milestones = await github.rest.issues.listMilestones({
43
+ owner: context.repo.owner,
44
+ repo: context.repo.repo,
45
+ state: 'open',
46
+ sort: 'title',
47
+ direction: 'desc'
48
+ })
49
+
50
+ if (milestones.data.length === 0) {
51
+ console.log('There are no milestones, skipping.');
52
+ return;
53
+ }
54
+
55
+ await github.rest.issues.update({
56
+ owner: context.repo.owner,
57
+ repo: context.repo.repo,
58
+ issue_number: context.payload.pull_request.number,
59
+ milestone: milestones.data[0].number
60
+ });
You can’t perform that action at this time.
0 commit comments