Skip to content

Commit 9744550

Browse files
Another attempt at including all tags in the changelog (#71)
* Another attempt at including all tags in the changelog * Update package.json * FIx formatting --------- Co-authored-by: Denis Tokarev <[email protected]>
1 parent 3e9edb6 commit 9744550

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
- name: Generate changelog
107107
run: |
108108
changelog=""
109-
109+
110110
# Get tags newest to oldest
111111
tags=($(git tag --sort=-version:refname))
112112
@@ -117,8 +117,10 @@ jobs:
117117
else
118118
untagged_commits=$(git --no-pager log --format="%s (%an) [%h]")
119119
fi
120-
121-
future_tag="$( awk -F'"' '/"version": ".+"/{ print $4; exit; }' package.json )"
120+
121+
# Get future version from package.json
122+
future_tag="$(awk -F'"' '/"version": ".+"/{ print $4; exit; }' package.json)"
123+
122124
if [ -n "$untagged_commits" ]; then
123125
tag_log="### ${future_tag}\n"
124126
while IFS= read -r commit; do
@@ -127,16 +129,20 @@ jobs:
127129
changelog="${tag_log}\n${changelog}"
128130
fi
129131
130-
# Loop over all tags, newest to oldest
132+
# Loop from i=0 to i <= tags.length (YES, intentionally +1)
131133
for ((i=0; i<=${#tags[@]}; i++)); do
132134
current="${tags[$i]}"
133-
next=""
135+
next="${tags[$((i+1))]}"
136+
137+
# Skip if current is empty (e.g., i == len)
138+
if [ -z "$current" ]; then
139+
continue
140+
fi
134141
135-
if (( i <= ${#tags[@]} - 1 )); then
136-
next="${tags[$((i+1))]}"
142+
if [ -n "$next" ]; then
137143
commits=$(git --no-pager log --format="%s (%an) [%h]" "${next}..${current}")
138144
else
139-
echo "TAG (current) = (${current})"
145+
# last tag (oldest), no previous one
140146
commits=$(git --no-pager log --format="%s (%an) [%h]" "${current}")
141147
fi
142148
@@ -150,7 +156,6 @@ jobs:
150156
done
151157
152158
changelog="# Changelog\n${changelog}"
153-
154159
echo -e "$changelog"
155160
printf '%b' "$changelog" > CHANGELOG.md
156161
- name: Upload new changelog

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "async-wait-until",
3-
"version": "2.0.26",
3+
"version": "2.0.27",
44
"description": "Waits until the given predicate function returns a truthy value, then resolves",
55
"main": "./dist/index.js",
66
"module": "./dist/index.esm.js",

0 commit comments

Comments
 (0)