Generate changelog #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate changelog | |
on: [ workflow_dispatch ] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
if: github.repository == 'pinterest/ktlint' | |
steps: | |
- uses: actions/checkout@v3 | |
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"] | |
}, | |
{ | |
"title": "### 🆕 Features", | |
"labels": ["feature changelog"], | |
"empty_content": "None" | |
}, | |
{ | |
"title": "### 🔧 Fixes", | |
"labels": ["fix changelog"], | |
"empty_content": "None" | |
}, | |
{ | |
"title": "### 📦 Dependencies", | |
"exhaustive_rules": false, | |
"rules": [ | |
{ | |
"pattern": "dependency changelog", | |
"on_property": "labels" | |
}, | |
{ | |
"pattern": "renovate\\[bot\\]", | |
"on_property": "author" | |
} | |
] | |
}, | |
{ | |
"title": "### 💬 Other", | |
"labels": [], | |
"exclude_labels": ["documentation", "exclude from changelog"] | |
} | |
], | |
"pr_template": "\n* #{{TITLE}} \n[##{{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" |