-
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (63 loc) · 2.28 KB
/
set-milestone-on-pr.yaml
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
name: Set Milestone
on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
- edited
- ready_for_review
- review_requested
jobs:
set-milestone:
if: github.event.pull_request.milestone == null
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@master"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: 'Get next minor version'
id: semvers
uses: "WyriHaximus/github-action-next-semvers@master"
with:
version: ${{ steps.previoustag.outputs.tag }}
- name: 'Get Milestones'
uses: "WyriHaximus/github-action-get-milestones@master"
id: milestones
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- run: printf "::set-output name=number::%s" $(printenv MILESTONES | jq --arg MILESTONE $(printenv MILESTONE) '.[] | select(.title == $MILESTONE) | .number')
id: querymilestone
env:
MILESTONES: ${{ steps.milestones.outputs.milestones }}
MILESTONE: ${{ steps.semvers.outputs.minor }}
- name: 'Create Milestone'
if: steps.querymilestone.outputs.number == ''
id: createmilestone
uses: "WyriHaximus/github-action-create-milestone@master"
with:
title: ${{ steps.semvers.outputs.minor }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: 'Select found or created Milestone'
id: selectmilestone
run: |
if [ $(echo ${QUERY_NUMBER} | wc -c) -eq 1 ] ; then
printf "::set-output name=number::%s" "${CREATED_NUMBER}"
exit 0
fi
printf "::set-output name=number::%s" "${QUERY_NUMBER}"
env:
CREATED_NUMBER: ${{ steps.createmilestone.outputs.number }}
QUERY_NUMBER: ${{ steps.querymilestone.outputs.number }}
- name: 'Set Milestone'
uses: "WyriHaximus/github-action-set-milestone@master"
with:
issue_number: ${{ github.event.pull_request.number }}
milestone_number: ${{ steps.selectmilestone.outputs.number }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"