Skip to content

Commit 6ea9954

Browse files
Merge ad27898 into 3369d04
2 parents 3369d04 + ad27898 commit 6ea9954

File tree

4 files changed

+35
-13
lines changed

4 files changed

+35
-13
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,27 @@ jobs:
3838
changelog changelog.md \
3939
--snippets=.snippets \
4040
--dry-run > latest-entry.json
41-
jq -r ".content" latest-entry.json > latest_description.txt
42-
sed -i '/^$/d' latest_description.txt
4341
echo "CHANGELOG_JSON=$(jq -c . < latest-entry.json)" >> $GITHUB_ENV
44-
echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT
45-
cat latest_description.txt >> $GITHUB_OUTPUT
46-
echo '"EOT"' >> $GITHUB_OUTPUT
47-
echo "latest_version=$(jq -r '.version' latest-entry.json)" >> $GITHUB_ENV
4842
- name: Update changelog with snippets
4943
run: |
5044
poetry run changelog-generator \
5145
changelog changelog.md \
5246
--snippets=.snippets \
5347
--in-place \
5448
--no-internal
49+
50+
poetry run changelog2version \
51+
--changelog_file changelog.md \
52+
--output changelog.json \
53+
--print \
54+
--debug
55+
56+
jq -r ".info.description" changelog.json > latest_description.txt
57+
sed -i '/^$/d' latest_description.txt
58+
echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT
59+
cat latest_description.txt >> $GITHUB_OUTPUT
60+
echo '"EOT"' >> $GITHUB_OUTPUT
61+
echo "latest_version=$(jq -r '.info.version' changelog.json)" >> $GITHUB_ENV
5562
- name: Build package
5663
run: |
5764
poetry run changelog2version \

.github/workflows/test-release.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,27 @@ jobs:
3535
changelog changelog.md \
3636
--snippets=.snippets \
3737
--dry-run > latest-entry.json
38-
jq -r ".content" latest-entry.json > latest_description.txt
39-
sed -i '/^$/d' latest_description.txt
4038
echo "CHANGELOG_JSON=$(jq -c . < latest-entry.json)" >> $GITHUB_ENV
41-
echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT
42-
cat latest_description.txt >> $GITHUB_OUTPUT
43-
echo '"EOT"' >> $GITHUB_OUTPUT
44-
echo "latest_version=$(jq -r '.version' latest-entry.json)" >> $GITHUB_ENV
4539
- name: Update changelog with snippets
4640
run: |
4741
poetry run changelog-generator \
4842
changelog changelog.md \
4943
--snippets=.snippets \
5044
--in-place \
5145
--no-internal
46+
47+
poetry run changelog2version \
48+
--changelog_file changelog.md \
49+
--output changelog.json \
50+
--print \
51+
--debug
52+
53+
jq -r ".info.description" changelog.json > latest_description.txt
54+
sed -i '/^$/d' latest_description.txt
55+
echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT
56+
cat latest_description.txt >> $GITHUB_OUTPUT
57+
echo '"EOT"' >> $GITHUB_OUTPUT
58+
echo "latest_version=$(jq -r '.info.version' changelog.json)" >> $GITHUB_ENV
5259
- name: Build package
5360
run: |
5461
poetry run changelog2version \

.snippets/29.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Remove print in branch property of HistoryWalker
2+
<!--
3+
type: bugfix
4+
scope: all
5+
affected: all
6+
-->
7+
8+
Using the `branch` property of `HistoryWalker` in `collector.py` would print `HEAD is detached: ...` in case the HEAD is detached during a pull request build. This could lead to errors while creating a changelog with `--dry-run` and passing the output to a supposed JSON file, being finally unable to parse it as with that detached HEAD output it's not a JSON anymore.

snippets2changelog/collector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def branch_name(self) -> str:
4343
try:
4444
return str(self._repo.active_branch)
4545
except Exception as e:
46-
# print(f"HEAD is detached: {e}")
46+
# HEAD is detached
4747
return str(self._repo.head.commit.hexsha)
4848

4949
@property

0 commit comments

Comments
 (0)