-
Notifications
You must be signed in to change notification settings - Fork 172
101 lines (97 loc) · 4.13 KB
/
generate_release_note.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
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Generate Release Note
on:
workflow_dispatch:
inputs:
version:
description: 'Version number to be generate release note this time'
required: true
env:
version: ${{ inputs.version }}
jobs:
generate-release-notes:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get Milestone Bug Issues
id: milestone-bug-issues
run: |
curl -sSL \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues?q=milestone=${{ env.version }}&labels=kind/bug" \
> milestone-bug-issues.json
- name: Get Milestone Feature Issues
id: milestone-feature-issues
run: |
curl -sSL \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues?q=milestone=${{ env.version }}&labels=kind/feature" \
> milestone-feature-issues.json
- name: Get Milestone Enhancement Issues
id: milestone-enhancement-issues
run: |
curl -sSL \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues?q=milestone=${{ env.version }}&labels=kind/enhancement" \
> milestone-enhancement-issues.json
- name: Get Milestone Doc Issues
id: milestone-doc-issues
run: |
curl -sSL \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues?q=milestone=${{ env.version }}&labels=area/docs" \
> milestone-doc-issues.json
- name: Generate Release Notes
id: generate-release-notes
run: |
release_notes="";
milestone_feature_issues=$(cat milestone-feature-issues.json)
if [[ $(echo "${milestone_feature_issues}" | jq '. | length') -eq 0 ]]; then
echo "No issues labeled as kind/feature"
else
release_notes="## ⭐ Feature\n"
for issue in $(echo "${milestone_feature_issues}" | jq -r '.[] | @base64'); do
_jq() {
echo ${issue} | base64 --decode | jq -r ${1}
}
release_notes+="- $(_jq '.title'). Issue #$(_jq '.number')\n"
done
fi
milestone_enhancement_issues=$(cat milestone-enhancement-issues.json)
if [[ $(echo "${milestone_enhancement_issues}" | jq '. | length') -eq 0 ]]; then
echo "No issues labeled as kind/enhancement"
else
release_notes+="## 📈 Improvements\n"
for issue in $(echo "${milestone_enhancement_issues}" | jq -r '.[] | @base64'); do
_jq() {
echo ${issue} | base64 --decode | jq -r ${1}
}
release_notes+="- $(_jq '.title'). Issue #$(_jq '.number')\n"
done
fi
milestone_bug_issues=$(cat milestone-bug-issues.json)
if [[ $(echo "${milestone_bug_issues}" | jq '. | length') -eq 0 ]]; then
echo "No issues labeled as kind/bug"
else
release_notes+="## 🐞 Fixes\n"
for issue in $(echo "${milestone_bug_issues}" | jq -r '.[] | @base64'); do
_jq() {
echo ${issue} | base64 --decode | jq -r ${1}
}
release_notes+="- $(_jq '.title'). Issue #$(_jq '.number')\n"
done
fi
milestone_doc_issues=$(cat milestone-doc-issues.json)
if [[ $(echo "${milestone_doc_issues}" | jq '. | length') -eq 0 ]]; then
echo "No issues labeled as area/docs"
else
release_notes+="## 📔 Documentation\n"
for issue in $(echo "${milestone_doc_issues}" | jq -r '.[] | @base64'); do
_jq() {
echo ${issue} | base64 --decode | jq -r ${1}
}
release_notes+="- $(_jq '.title'). Issue #$(_jq '.number')\n"
done
fi
echo "Generated Release Notes:"
echo -e "$release_notes"