14 Commits
v2 ... v1.0.1

Author SHA1 Message Date
fa1a8673f6 chore(changelog): update changelog for v1.0.1
All checks were successful
Create Major Version Tag / update-major-tag (release) Successful in 12s
2025-09-27 20:10:24 +00:00
d08cc144ed chore(version): bump to 1.0.1
All checks were successful
Auto Changelog & Release / release (push) Successful in 14s
2025-09-27 22:10:07 +02:00
073026d7c9 chore(changelog): update unreleased changelog 2025-09-27 20:09:47 +00:00
94980be3e5 chore(scripts): check for existing Python installation
All checks were successful
Auto Changelog & Release / release (push) Successful in 14s
2025-09-27 22:09:32 +02:00
4bd419d38f chore(changelog): update changelog for v1.0.0
All checks were successful
Create Major Version Tag / update-major-tag (release) Successful in 12s
2025-09-27 19:58:13 +00:00
a6ee83e109 chore(version): bump to 1.0.0
All checks were successful
Auto Changelog & Release / release (push) Successful in 15s
2025-09-27 21:57:56 +02:00
3e6b722501 chore(changelog): update unreleased changelog 2025-09-27 19:57:01 +00:00
fedcc1ff41 fix(release): fix changelog generation pipe usage
All checks were successful
Auto Changelog & Release / release (push) Successful in 16s
2025-09-27 21:56:43 +02:00
399f0edb40 chore(changelog): update unreleased changelog 2025-09-27 19:55:35 +00:00
73a1b5cc24 chore(release): update action version in workflow
All checks were successful
Auto Changelog & Release / release (push) Successful in 20s
2025-09-27 21:53:35 +02:00
ddda682c80 chore(changelog): update unreleased changelog 2025-09-27 19:53:02 +00:00
121ea5b57a chore(ci): allow non-main branch releases
All checks were successful
Auto Changelog & Release / release (push) Successful in 10s
2025-09-27 21:49:18 +02:00
4d248aefd1 chore(changelog): update unreleased changelog 2025-09-27 19:48:46 +00:00
8de8b47038 feat(ci)!: enhance changelog generation with context augmentation
All checks were successful
Auto Changelog & Release / release (push) Successful in 13s
2025-09-27 21:44:20 +02:00
9 changed files with 128 additions and 17 deletions

View File

@@ -14,6 +14,7 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Release - name: Release
uses: https://git.0xmax42.io/actions/auto-changelog-release-action@v0.3.0 uses: https://git.0xmax42.io/actions/auto-changelog-release-action@v0
with: with:
token: ${{ secrets.RELEASE_PUBLISH_TOKEN }} token: ${{ secrets.RELEASE_PUBLISH_TOKEN }}
allow_non_main_release: "true"

View File

@@ -2,6 +2,27 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [1.0.1](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v1.0.0..v1.0.1) - 2025-09-27
### ⚙️ Miscellaneous Tasks
- *(scripts)* Check for existing Python installation - ([94980be](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/94980be3e5e5827b75edf9abeab0987709fa3122))
## [1.0.0](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.3..v1.0.0) - 2025-09-27
### 🚀 Features
- *(ci)* [**breaking**] Enhance changelog generation with context augmentation - ([8de8b47](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/8de8b470386cf9f21cec660ba71d840ea6786231))
### 🐛 Bug Fixes
- *(release)* Fix changelog generation pipe usage - ([fedcc1f](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/fedcc1ff41b9535f5002d046427dd640b647bde4))
### ⚙️ Miscellaneous Tasks
- *(release)* Update action version in workflow - ([73a1b5c](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/73a1b5cc243248b50275b2368a4cd92bbb4a1a8e))
- *(ci)* Allow non-main branch releases - ([121ea5b](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/121ea5b57a587626a036738c23e2983380470dd7))
## [0.4.3](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.2..v0.4.3) - 2025-06-29 ## [0.4.3](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.2..v0.4.3) - 2025-06-29
### 🐛 Bug Fixes ### 🐛 Bug Fixes

View File

@@ -1 +1 @@
0.4.3 1.0.1

View File

@@ -44,6 +44,11 @@ runs:
run: | run: |
${{ github.action_path }}/scripts/install-git-cliff.sh "${{ steps.cliff_version.outputs.version }}" ${{ github.action_path }}/scripts/install-git-cliff.sh "${{ steps.cliff_version.outputs.version }}"
- name: Install Python
shell: bash
run: |
${{ github.action_path }}/scripts/install-python.sh
- name: Set up git - name: Set up git
shell: bash shell: bash
run: | run: |

View File

@@ -1,4 +1,4 @@
# CLIFF_VERSION=2.8.0 # CLIFF_VERSION=2.10.1
# git-cliff ~ default configuration file # git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration # https://git-cliff.org/docs/configuration
# #
@@ -10,18 +10,15 @@ owner = "actions"
repo = "auto-changelog-release-action" repo = "auto-changelog-release-action"
[changelog] [changelog]
# postprocessors
postprocessors = [ postprocessors = [
{ pattern = '<GITEA_URL>', replace = "https://git.0xmax42.io" }, # replace gitea url { pattern = '<GITEA_URL>', replace = "https://git.0xmax42.io" }, # replace gitea url
] ]
# template for the changelog header
header = """ header = """
# Changelog\n # Changelog\n
All notable changes to this project will be documented in this file.\n All notable changes to this project will be documented in this file.\n
""" """
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """ body = """
{%- macro remote_url() -%} {%- macro remote_url() -%}
<GITEA_URL>/{{ remote.gitea.owner }}/{{ remote.gitea.repo }} <GITEA_URL>/{{ remote.gitea.owner }}/{{ remote.gitea.repo }}
@@ -38,16 +35,26 @@ body = """
## [unreleased] ## [unreleased]
{% endif %}\ {% endif %}\
{% for group, commits in commits | group_by(attribute="group") %} {% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }} ### {{ group | striptags | trim | upper_first }}\n
{% for commit in commits %} {% for commit in commits %}\
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ {% if commit.merge_commit %}\
{% if commit.breaking %}[**breaking**] {% endif %}\ - 🔀 **{{ commit.message | upper_first }}** - \
{{ commit.message | upper_first }} - \ ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\ {% for child in commit.extra.children %}
{% endfor %} {{ " " | safe }}- {% if child.scope %}*({{ child.scope }})* {% endif %}\
{% if child.breaking %}[**breaking**] {% endif %}\
{{ child.message | upper_first }} - \
([{{ child.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ child.id }}))\
{% endfor %}\
{% else %}\
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }} - \
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
{% endif %}
{% endfor %}\
{% endfor %}\n {% endfor %}\n
""" """
# template for the changelog footer
footer = """ footer = """
""" """

59
scripts/augment_context.py Executable file
View File

@@ -0,0 +1,59 @@
#!/usr/bin/env python3
import json
import subprocess
import sys
def git_commits_between(parent, merge):
"""Return list of commit hashes between parent and merge (exclusive of parent, inclusive of merge)."""
out = subprocess.check_output(
["git", "rev-list", f"{parent}..{merge}", "--no-merges"],
text=True
)
return [line.strip() for line in out.splitlines() if line.strip()]
def load_context(path=None):
if path:
with open(path) as f:
return json.load(f)
else:
return json.load(sys.stdin)
def main(path=None):
context = load_context(path)
commits = context[0]["commits"]
commits_by_id = {c["id"]: c for c in commits}
new_commits = []
consumed = set()
for c in commits:
if c.get("merge_commit"):
parents = subprocess.check_output(
["git", "rev-list", "--parents", "-n", "1", c["id"]],
text=True
).strip().split()
merge_id, *parent_ids = parents
if len(parent_ids) >= 2:
mainline = parent_ids[0]
children_ids = git_commits_between(mainline, merge_id)
children = []
for cid in children_ids:
if cid in commits_by_id:
children.append(commits_by_id[cid])
consumed.add(cid)
if not c.get("extra") or not isinstance(c["extra"], dict):
c["extra"] = {}
c["extra"]["children"] = children
new_commits.append(c)
filtered = [c for c in new_commits if c["id"] not in consumed]
context[0]["commits"] = filtered
json.dump(context, sys.stdout, indent=4)
if __name__ == "__main__":
main(sys.argv[1] if len(sys.argv) > 1 else None)

View File

@@ -8,7 +8,9 @@ GIT_BRANCH="${GITHUB_REF##refs/heads/}"
# === Step 1: Generate Changelog (only if file exists or on main) === # === Step 1: Generate Changelog (only if file exists or on main) ===
if [[ -f "$CHANGELOG_FILE" || "$GIT_BRANCH" == "main" ]]; then if [[ -f "$CHANGELOG_FILE" || "$GIT_BRANCH" == "main" ]]; then
echo "📄 Generating $CHANGELOG_FILE using git-cliff..." echo "📄 Generating $CHANGELOG_FILE using git-cliff..."
git-cliff -c "$CLIFF_CONFIG" -o "$CHANGELOG_FILE" git-cliff -c "$CLIFF_CONFIG" --context \
| "${GITHUB_ACTION_PATH}/scripts/augment_context.py" \
| git-cliff -c "$CLIFF_CONFIG" --from-context - -o "$CHANGELOG_FILE"
else else
echo "ℹ️ $CHANGELOG_FILE does not exist and branch is not 'main'. Skipping generation." echo "ℹ️ $CHANGELOG_FILE does not exist and branch is not 'main'. Skipping generation."
exit 0 exit 0

14
scripts/install-python.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# install-python.sh – installs the latest Python version through apt
# Usage: sudo ./install-python.sh
set -euo pipefail
if command -v python3 >/dev/null 2>&1; then
echo "ℹ️ Python $(python3 --version) is already installed"
exit 0
fi
apt update
apt install -y python3
echo "✅ Python $(python3 --version) installed"

View File

@@ -64,7 +64,9 @@ echo "📦 Version: $VERSION"
# === Step 2: Generate changelog for release === # === Step 2: Generate changelog for release ===
echo "📄 Generating changelog for tag v$VERSION" echo "📄 Generating changelog for tag v$VERSION"
git-cliff -c "$CLIFF_CONFIG" -t "v$VERSION" -o "$CHANGELOG_FILE" git-cliff -c "$CLIFF_CONFIG" -t "v$VERSION" --context \
| "${GITHUB_ACTION_PATH}/scripts/augment_context.py" \
| git-cliff -c "$CLIFF_CONFIG" -t "v$VERSION" --from-context - -o "$CHANGELOG_FILE"
ESCAPED_VERSION="$(echo "$VERSION" | sed 's/\./\\./g')" ESCAPED_VERSION="$(echo "$VERSION" | sed 's/\./\\./g')"