Skip to content

Commit 62d0f30

Browse files
committed
[doc] Update release notes
1 parent 84f3709 commit 62d0f30

File tree

2 files changed

+202
-0
lines changed

2 files changed

+202
-0
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
#!/bin/bash
2+
set -e
3+
4+
MILESTONE_NAME="next"
5+
6+
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
7+
8+
CURL_API_HEADER=(--header "X-GitHub-Api-Version: 2022-11-28")
9+
CURL_AUTH_HEADER=()
10+
if [ -n "$GITHUB_TOKEN" ]; then
11+
echo "Will use env var GITHUB_TOKEN for github REST API"
12+
CURL_AUTH_HEADER=(--header "Authorization: Bearer $GITHUB_TOKEN")
13+
fi
14+
15+
# determine current milestone
16+
MILESTONE_JSON=$(curl "${CURL_API_HEADER[@]}" "${CURL_AUTH_HEADER[@]}" -s "https://api.github.com/repos/pmd/pmd-designer/milestones?state=open&direction=desc&per_page=10&page=1"|jq ".[] | select(.title == \"$MILESTONE_NAME\")")
17+
#DEBUG ONLY
18+
#MILESTONE_JSON='{"number":80,"closed_issues":40}'
19+
#DEBUG ONLY
20+
MILESTONE=$(echo "$MILESTONE_JSON" | jq .number)
21+
22+
PAGE="1"
23+
HAS_NEXT="true"
24+
ISSUES_JSON=""
25+
while [ "$HAS_NEXT" = "true" ]; do
26+
echo "Fetching issues for milestone ${MILESTONE} page ${PAGE}..."
27+
URL="https://api.github.com/repos/pmd/pmd-designer/issues?state=closed&sort=created&direction=asc&per_page=30&page=${PAGE}&milestone=${MILESTONE}"
28+
RESPONSE="$(curl "${CURL_API_HEADER[@]}" "${CURL_AUTH_HEADER[@]}" -s -w "\nLink: %header{link}" "$URL")"
29+
30+
#DEBUG ONLY
31+
#echo "$RESPONSE" > issues-response-${PAGE}.txt
32+
#RESPONSE="$(cat issues-response-${PAGE}.txt)"
33+
#DEBUG ONLY
34+
35+
LINK_HEADER="$(echo "$RESPONSE" | tail -1)"
36+
BODY="$(echo "$RESPONSE" | head -n -1)"
37+
38+
#DEBUG ONLY
39+
#echo "$BODY" > "issues-response-page-${PAGE}.txt"
40+
#BODY="$(cat "issues-response-page-${PAGE}.txt")"
41+
#DEBUG ONLY
42+
43+
COMMA=","
44+
if [ "$PAGE" -eq 1 ]; then
45+
COMMA=""
46+
fi
47+
ISSUES_JSON="${ISSUES_JSON}${COMMA}${BODY}"
48+
49+
if [[ $LINK_HEADER == *"; rel=\"next\""* ]]; then
50+
HAS_NEXT="true"
51+
else
52+
HAS_NEXT="false"
53+
fi
54+
PAGE=$((PAGE + 1))
55+
56+
#DEBUG ONLY
57+
#HAS_NEXT="true"
58+
#if [ "$PAGE" -gt 2 ]; then break; fi
59+
#DEBUG ONLY
60+
61+
# stop after 10 pages
62+
if [ "$PAGE" -gt 10 ]; then
63+
echo
64+
echo
65+
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
66+
echo "!!!!!!!!!!!!!! reached page 10, stopping now !!!!!!!!!!!!!"
67+
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
68+
echo
69+
echo
70+
break;
71+
fi
72+
done
73+
74+
75+
ISSUES_JSON="$(echo "[ $ISSUES_JSON ]" | jq 'flatten(1)')"
76+
echo "Found $(echo "$ISSUES_JSON" | jq length) issues/pull requests"
77+
#DEBUG ONLY
78+
#echo "$ISSUES_JSON" > issues-all.txt
79+
#DEBUG ONLY
80+
81+
FIXED_ISSUES_JSON="$(echo "$ISSUES_JSON" | jq 'map(select(has("pull_request") | not))')"
82+
FIXED_ISSUES="$(echo "$FIXED_ISSUES_JSON" | jq --raw-output '.[] | "* [#\(.number)](https://github.com/pmd/pmd-designer/issues/\(.number)): \(.title | gsub("@"; "@<!-- -->") | gsub("\\["; "\\["))"')"
83+
FIXED_ISSUES="**🐛 Fixed issues:**
84+
$FIXED_ISSUES
85+
"
86+
87+
PULL_REQUESTS_JSON="$(echo "$ISSUES_JSON" | jq 'map(select(has("pull_request"))) | map(select(contains({labels: [{name: "dependencies"}]}) | not))')"
88+
PULL_REQUESTS="$(echo "$PULL_REQUESTS_JSON" | jq --raw-output '.[] | "* [#\(.number)](https://github.com/pmd/pmd-designer/pull/\(.number)): \(.title | gsub("@"; "@<!-- -->") | gsub("\\["; "\\[")) - @\(.user.login)"')"
89+
90+
AUTHORS="$(echo "$PULL_REQUESTS_JSON" | jq --raw-output '.[].user.login' | sort | uniq)"
91+
echo "Resolving $(echo "$AUTHORS" | wc -l) author names in pull requests..."
92+
for login in $AUTHORS; do
93+
USER_JSON="$(curl "${CURL_API_HEADER[@]}" "${CURL_AUTH_HEADER[@]}" -s "https://api.github.com/users/$login")"
94+
#DEBUG ONLY
95+
#USER_JSON="{\"login\": \"$login\", \"name\": \"foo $login\"}"
96+
#DEBUG_ONLY
97+
USER_NAME="$(echo "$USER_JSON" | jq --raw-output ".name // \"$login\"")"
98+
search=" - \@$login"
99+
replacement=" - [$USER_NAME](https://github.com/$login) (@$login)"
100+
PULL_REQUESTS="${PULL_REQUESTS//${search}/${replacement}}"
101+
done
102+
103+
PULL_REQUESTS="**✨ Merged pull requests:**
104+
$PULL_REQUESTS
105+
"
106+
107+
DEPENDENCY_UPDATES_JSON="$(echo "$ISSUES_JSON" | jq 'map(select(has("pull_request"))) | map(select(contains({labels: [{name: "dependencies"}]})))')"
108+
DEPENDENCY_UPDATES="$(echo "$DEPENDENCY_UPDATES_JSON" | jq --raw-output '.[] | "* [#\(.number)](https://github.com/pmd/pmd-designer/pull/\(.number)): \(.title | gsub("@"; "@<!-- -->") | gsub("\\["; "\\["))"')"
109+
DEPENDENCY_UPDATES_COUNT=$(echo "$DEPENDENCY_UPDATES_JSON" | jq length)
110+
if [ -z "$DEPENDENCY_UPDATES" ]; then
111+
DEPENDENCY_UPDATES="**📦 Dependency updates:**
112+
113+
No dependency updates.
114+
"
115+
else
116+
DEPENDENCY_UPDATES="**📦 Dependency updates:**
117+
<details>
118+
<summary>$DEPENDENCY_UPDATES_COUNT updates</summary>
119+
120+
$DEPENDENCY_UPDATES
121+
122+
</details>
123+
"
124+
fi
125+
126+
function insert() {
127+
local FULL_TEXT="$1"
128+
local FROM_MARKER="$2"
129+
local END_MARKER="$3"
130+
local INSERTION="$4"
131+
local fromLine
132+
local endLine
133+
local headText
134+
local tailText
135+
fromLine="$(echo "$FULL_TEXT" | grep -n "$FROM_MARKER" | head -1 | cut -d ":" -f 1)"
136+
endLine="$(echo "$FULL_TEXT" | grep -n "$END_MARKER" | head -1 | cut -d ":" -f 1)"
137+
headText="$(echo "$FULL_TEXT" | head -n "$((fromLine - 1))")"
138+
tailText="$(echo "$FULL_TEXT" | tail -n "+$endLine")"
139+
echo "$headText
140+
141+
$INSERTION
142+
143+
$tailText"
144+
}
145+
146+
RELEASE_NOTES_FILE="${BASEDIR}/CHANGELOG.md"
147+
echo "Updating $RELEASE_NOTES_FILE now..."
148+
149+
RELEASE_NOTES=$(cat "$RELEASE_NOTES_FILE")
150+
echo " adding fixed issues"
151+
RELEASE_NOTES="$(insert "$RELEASE_NOTES" "**🐛 Fixed issues:**" "**✨ Merged pull requests:**" "$FIXED_ISSUES")"
152+
echo " adding pull requests"
153+
RELEASE_NOTES="$(insert "$RELEASE_NOTES" "**✨ Merged pull requests:**" "**📦 Dependency updates:**" "$PULL_REQUESTS")"
154+
echo " adding dependencies"
155+
RELEASE_NOTES="$(insert "$RELEASE_NOTES" "**📦 Dependency updates:**" "See https://github.com/pmd/pmd-designer/milestone/$MILESTONE" "$DEPENDENCY_UPDATES")"
156+
157+
echo "$RELEASE_NOTES" > "$RELEASE_NOTES_FILE"

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,53 @@
77
**🐛 Fixed issues:**
88

99
**✨ Merged pull requests:**
10+
* [#168](https://github.com/pmd/pmd-designer/pull/168): Refactor GitHub Actions Workflows - [Andreas Dangel](https://github.com/adangel) (@adangel)
11+
* [#169](https://github.com/pmd/pmd-designer/pull/169): \[ci] publish-snapshot/release: migrate to central portal - [Andreas Dangel](https://github.com/adangel) (@adangel)
12+
* [#170](https://github.com/pmd/pmd-designer/pull/170): \[ci] Make build a reuseable workflow - [Andreas Dangel](https://github.com/adangel) (@adangel)
1013

1114
**📦 Dependency updates:**
15+
<details>
16+
<summary>36 updates</summary>
17+
18+
* [#108](https://github.com/pmd/pmd-designer/pull/108): Bump org.apache.maven.plugins:maven-clean-plugin from 3.3.2 to 3.4.0
19+
* [#109](https://github.com/pmd/pmd-designer/pull/109): Bump org.apache.maven.plugins:maven-surefire-plugin from 3.2.5 to 3.5.2
20+
* [#110](https://github.com/pmd/pmd-designer/pull/110): Bump org.apache.maven.plugins:maven-site-plugin from 4.0.0-M13 to 4.0.0-M16
21+
* [#112](https://github.com/pmd/pmd-designer/pull/112): Bump org.apache.maven.plugins:maven-release-plugin from 3.0.1 to 3.1.1
22+
* [#113](https://github.com/pmd/pmd-designer/pull/113): Bump org.apache.maven.plugins:maven-source-plugin from 3.3.0 to 3.3.1
23+
* [#114](https://github.com/pmd/pmd-designer/pull/114): Bump junit5.version from 5.11.0 to 5.11.4
24+
* [#115](https://github.com/pmd/pmd-designer/pull/115): Bump com.puppycrawl.tools:checkstyle from 10.18.1 to 10.21.2
25+
* [#117](https://github.com/pmd/pmd-designer/pull/117): Bump org.apache.maven.plugins:maven-checkstyle-plugin from 3.5.0 to 3.6.0
26+
* [#119](https://github.com/pmd/pmd-designer/pull/119): Bump org.apache.maven.plugins:maven-compiler-plugin from 3.12.1 to 3.13.0
27+
* [#120](https://github.com/pmd/pmd-designer/pull/120): Bump PMD from 7.8.0 to 7.10.0 for checks
28+
* [#122](https://github.com/pmd/pmd-designer/pull/122): Bump org.codehaus.mojo:build-helper-maven-plugin from 3.5.0 to 3.6.0
29+
* [#126](https://github.com/pmd/pmd-designer/pull/126): Bump net.sourceforge.pmd:pmd-lang-test from 7.9.0 to 7.10.0
30+
* [#127](https://github.com/pmd/pmd-designer/pull/127): Bump org.apache.maven.plugins:maven-install-plugin from 3.1.1 to 3.1.3
31+
* [#128](https://github.com/pmd/pmd-designer/pull/128): Bump org.codehaus.mojo:exec-maven-plugin from 3.2.0 to 3.5.0
32+
* [#129](https://github.com/pmd/pmd-designer/pull/129): Bump org.checkerframework:checker-qual from 3.48.4 to 3.49.0
33+
* [#130](https://github.com/pmd/pmd-designer/pull/130): Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.4.1 to 3.5.0
34+
* [#131](https://github.com/pmd/pmd-designer/pull/131): Bump org.apache.maven.plugins:maven-shade-plugin from 3.5.2 to 3.6.0
35+
* [#134](https://github.com/pmd/pmd-designer/pull/134): Bump com.puppycrawl.tools:checkstyle from 10.21.2 to 10.21.3
36+
* [#135](https://github.com/pmd/pmd-designer/pull/135): Bump org.apache.maven.plugins:maven-compiler-plugin from 3.13.0 to 3.14.0
37+
* [#136](https://github.com/pmd/pmd-designer/pull/136): Bump org.apache.maven.plugins:maven-clean-plugin from 3.4.0 to 3.4.1
38+
* [#137](https://github.com/pmd/pmd-designer/pull/137): Bump PMD from 7.10.0 to 7.11.0 for checks
39+
* [#139](https://github.com/pmd/pmd-designer/pull/139): Bump net.sourceforge.pmd:pmd-lang-test from 7.10.0 to 7.11.0
40+
* [#140](https://github.com/pmd/pmd-designer/pull/140): Bump org.apache.maven.plugins:maven-install-plugin from 3.1.3 to 3.1.4
41+
* [#141](https://github.com/pmd/pmd-designer/pull/141): Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.3 to 3.1.4
42+
* [#144](https://github.com/pmd/pmd-designer/pull/144): Bump org.checkerframework:checker-qual from 3.49.0 to 3.49.1
43+
* [#145](https://github.com/pmd/pmd-designer/pull/145): Bump com.puppycrawl.tools:checkstyle from 10.21.3 to 10.21.4
44+
* [#146](https://github.com/pmd/pmd-designer/pull/146): Bump junit5.version from 5.11.4 to 5.12.1
45+
* [#150](https://github.com/pmd/pmd-designer/pull/150): Bump org.apache.maven.plugins:maven-surefire-plugin from 3.5.2 to 3.5.3
46+
* [#151](https://github.com/pmd/pmd-designer/pull/151): Bump net.sourceforge.pmd:pmd-lang-test from 7.11.0 to 7.12.0
47+
* [#154](https://github.com/pmd/pmd-designer/pull/154): Bump com.puppycrawl.tools:checkstyle from 10.21.4 to 10.23.0
48+
* [#157](https://github.com/pmd/pmd-designer/pull/157): Bump junit5.version from 5.12.1 to 5.12.2
49+
* [#158](https://github.com/pmd/pmd-designer/pull/158): Bump org.junit.platform:junit-platform-launcher from 1.12.1 to 1.12.2
50+
* [#159](https://github.com/pmd/pmd-designer/pull/159): Bump org.checkerframework:checker-qual from 3.49.1 to 3.49.2
51+
* [#165](https://github.com/pmd/pmd-designer/pull/165): Bump com.puppycrawl.tools:checkstyle from 10.23.0 to 10.23.1
52+
* [#166](https://github.com/pmd/pmd-designer/pull/166): Bump net.sourceforge.pmd:pmd-lang-test from 7.12.0 to 7.13.0
53+
* [#167](https://github.com/pmd/pmd-designer/pull/167): Bump org.checkerframework:checker-qual from 3.49.2 to 3.49.3
54+
55+
</details>
56+
1257

1358
See https://github.com/pmd/pmd-designer/milestone/17
1459

0 commit comments

Comments
 (0)