Skip to content

Generate changelog

Generate changelog #23

name: Generate changelog
on: [ workflow_dispatch ]
jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'pinterest/ktlint'
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
fetch-depth: 0 # fetch all commits/branches/tags
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 19
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Get last released version
run: echo "version=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
fromTag: "${{ env.version }}"
# This Github action is run before building a new release. All PR's created after last release and between current HEAD are to be
# included
toTag: "HEAD"
configurationJson: |
{
"template": "## Unreleased\n\n#{{CHANGELOG}}",
"categories": [
{
"title": "### 💔 Breaking changes",
"labels": ["api changelog"],
"exclude_labels": ["exclude from changelog"]
},
{
"title": "### 🆕 Features",
"labels": ["feature changelog"],
"exclude_labels": ["exclude from changelog"],
"empty_content": "None"
},
{
"title": "### 🔧 Fixes",
"labels": ["fix changelog"],
"exclude_labels": ["exclude from changelog"],
"empty_content": "None"
},
{
"title": "### 📦 Dependencies",
"exhaustive_rules": false,
"rules": [
{
"pattern": "dependency changelog",
"on_property": "labels"
},
{
"pattern": "renovate\\[bot\\]",
"on_property": "author"
}
],
"exclude_labels": ["exclude from changelog"]
},
{
"title": "### 💬 Other",
"labels": [],
"exclude_labels": ["documentation", "exclude from changelog"]
}
],
"pr_template": "\n* #{{TITLE}} - [##{{NUMBER}}](#{{URL}}), by @#{{AUTHOR}}",
"empty_template": "- no changes",
"sort": {
"order": "ASC",
"on_property": "mergedAt"
},
"max_pull_requests": 1000,
"max_back_track_time_days": 1000
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Echo generated changelog
env:
CHANGELOG: ${{ steps.build_changelog.outputs.changelog }}
run: echo -e "$CHANGELOG"