Skip to content

Commit 3c0a702

Browse files
authored
docs: add pipeline changelog
1 parent 04e3ed4 commit 3c0a702

File tree

3 files changed

+401
-0
lines changed

3 files changed

+401
-0
lines changed

.github/workflows/cl.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
name: Changelog Pipeline
3+
4+
on:
5+
push:
6+
branches: ["develop"]
7+
pull_request:
8+
branches: ["develop"]
9+
10+
workflow_dispatch:
11+
12+
jobs:
13+
update-changelog2:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Generate unreleased changelog
24+
uses: orhun/git-cliff-action@v2
25+
id: generate_unreleased_changelog
26+
with:
27+
config: ./cliff.toml
28+
args: --unreleased --bump
29+
env:
30+
OUTPUT: CHANGELOG.md
31+
32+
- name: Print the changelog
33+
run: cat "${{ steps.generate_unreleased_changelog.outputs.changelog }}"
34+
35+
- name: Format changelog for Slack
36+
id: format_for_slack
37+
run: |
38+
output=$(python scripts/changelog_slack.py ${{ steps.generate_unreleased_changelog.outputs.changelog }})
39+
echo "::set-output name=formatted_json::$output"
40+
echo "Formatted JSON output for debugging: $output"
41+
echo "Changelog for debugging: ${{ steps.generate_unreleased_changelog.outputs.changelog }}"
42+
env:
43+
UNRELEASED_CHANGELOG: ${{ steps.generate_unreleased_changelog.outputs.changelog }}
44+
45+
# - name: Debug Python
46+
# id: debug_python
47+
# run: |
48+
# echo "Debug2 Python output for debugging: ${{ steps.format_for_slack.outputs.formatted_json }}"
49+
50+
51+
- name: Send custom JSON data to Slack workflow
52+
uses: slackapi/[email protected]
53+
with:
54+
channel-id: "C06N79SSDD5"
55+
payload: ${{ steps.format_for_slack.outputs.formatted_json }}
56+
env:
57+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
58+
59+
- name: Update CHANGELOG.md
60+
uses: orhun/git-cliff-action@v2
61+
with:
62+
config: ./cliff.toml
63+
args: --bump
64+
env:
65+
OUTPUT: CHANGELOG.md
66+
67+
- name: Commit and push changes
68+
uses: stefanzweifel/git-auto-commit-action@v4
69+
with:
70+
commit_message: "chore(changelog): update changelog [skip ci]"
71+
72+
- name: Create and push tag
73+
env:
74+
NEW_TAG: ""
75+
run: |
76+
echo "New Tag BEFORE: $NEW_TAG"
77+
NEW_TAG=$(git cliff --bumped-version)
78+
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
79+
git tag $NEW_TAG
80+
git push origin $NEW_TAG
81+
echo "New Tag AFTER: $NEW_TAG"
82+
83+
# Optional: Create GitHub release
84+
- name: Create GitHub Release
85+
uses: actions/create-release@v1
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
with:
89+
tag_name: ${{ env.NEW_TAG }}
90+
release_name: Release ${{ env.NEW_TAG }}
91+
body: ${{ steps.generate_unreleased_changelog.outputs.changelog }}

cliff.toml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# changelog header
6+
header = """
7+
# Changelog\n
8+
All notable changes to this project will be documented in this file.\n
9+
"""
10+
# template for the changelog body
11+
# https://keats.github.io/tera/docs/#introduction
12+
body = """
13+
{% if version %}\
14+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
15+
{% else %}\
16+
## [unreleased]
17+
{% endif %}\
18+
{% if previous %}\
19+
{% if previous.commit_id %}
20+
[{{ previous.commit_id | truncate(length=7, end="") }}]({{ previous.commit_id }})...\
21+
[{{ commit_id | truncate(length=7, end="") }}]({{ commit_id }})
22+
{% endif %}\
23+
{% endif %}\
24+
{% for group, commits in commits | group_by(attribute="group") %}
25+
### {{ group | upper_first }}
26+
{% for commit in commits %}
27+
- {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }}))\
28+
{% for footer in commit.footers -%}
29+
, {{ footer.token }}{{ footer.separator }}{{ footer.value }}\
30+
{% endfor %}\
31+
{% endfor %}
32+
{% endfor %}\n
33+
"""
34+
# template for the changelog footer
35+
footer = """
36+
<!-- generated by git-cliff -->
37+
"""
38+
# remove the leading and trailing whitespace from the templates
39+
trim = true
40+
41+
[git]
42+
# parse the commits based on https://www.conventionalcommits.org
43+
conventional_commits = true
44+
# filter out the commits that are not conventional
45+
filter_unconventional = true
46+
# process each line of a commit as an individual commit
47+
split_commits = false
48+
# regex for parsing and grouping commits
49+
commit_parsers = [
50+
{ message = "^feat", group = "Features" },
51+
{ message = "^fix", group = "Bug Fixes" },
52+
{ message = "^doc", group = "Documentation" },
53+
{ message = "^perf", group = "Performance" },
54+
{ message = "^refactor", group = "Refactor" },
55+
{ message = "^style", group = "Styling" },
56+
{ message = "^test", group = "Testing" },
57+
{ message = "^chore\\(deps.*\\)", skip = true },
58+
{ message = "^chore\\(pr\\)", skip = true },
59+
{ message = "^chore\\(pull\\)", skip = true },
60+
{ message = "^chore\\(release\\): prepare for", skip = true },
61+
{ message = "^chore|^ci", group = "Miscellaneous Tasks" },
62+
{ body = ".*security", group = "Security" },
63+
]
64+
# protect breaking changes from being skipped due to matching a skipping commit_parser
65+
protect_breaking_commits = false
66+
# filter out the commits that are not matched by commit parsers
67+
filter_commits = false
68+
# regex for matching git tags
69+
tag_pattern = "v[0-9].*"
70+
# regex for skipping tags
71+
skip_tags = "v0.1.0-beta.1"
72+
# regex for ignoring tags
73+
ignore_tags = ""
74+
# sort the tags topologically
75+
topo_order = false
76+
# sort the commits inside sections by oldest/newest order
77+
sort_commits = "oldest"

0 commit comments

Comments
 (0)