Skip to content

Commit f0a6a28

Browse files
committed
ci: add latest-changelog.awk
1 parent 72b5b10 commit f0a6a28

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,14 @@ jobs:
286286
- name: Make source archive
287287
run: |
288288
./contrib/release/make-archive.sh artifacts
289+
- name: Latest Changes
290+
run: |
291+
./contrib/release/latest-changelog.awk CHANGELOG.md >latest-changes.md
289292
- name: Draft Release
290293
uses: softprops/action-gh-release@v1
291294
with:
292295
draft: true
296+
body_path: latest-changes.md
293297
fail_on_unmatched_files: true
294298
files: |
295299
artifacts/stgit-*.tar.gz
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env -S awk -f
2+
3+
# Extract the latest release notes from CHANGELOG.md.
4+
#
5+
# The h3 sections from the first h2 section are printed.
6+
7+
BEGIN {
8+
foundFirstH2 = 0
9+
foundFirstH3 = 0
10+
foundSecondH2 = 0
11+
}
12+
13+
{
14+
if (!foundFirstH2) {
15+
if ($0 ~ /^## /) {
16+
foundFirstH2 = 1
17+
}
18+
} else if (!foundFirstH3) {
19+
if ($0 ~ /^### /) {
20+
foundFirstH3 = 1
21+
print $0
22+
}
23+
} else if (!foundSecondH2) {
24+
if ($0 ~ /^## /) {
25+
foundSecondH2 = 1
26+
} else {
27+
print $0
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)