workflows - use commit message body minus empty lines as-is for changelog generation (#736)
This commit is contained in:
parent
9e9c0ff0b1
commit
67be8442da
16
.github/workflows/autobuild.yaml
vendored
16
.github/workflows/autobuild.yaml
vendored
@ -71,23 +71,25 @@ jobs:
|
|||||||
id: get-commit-message
|
id: get-commit-message
|
||||||
run: |
|
run: |
|
||||||
$message = git log -1 --pretty=%b
|
$message = git log -1 --pretty=%b
|
||||||
echo "::set-output name=message::$message"
|
$messagePath = 'COMMIT_MSG'
|
||||||
|
echo $message >> $messagePath
|
||||||
|
echo "messagePath=$messagePath" >> $env:GITHUB_ENV
|
||||||
|
|
||||||
- name: Update CHANGELOG.md
|
- name: Update CHANGELOG.md
|
||||||
run: |
|
run: |
|
||||||
$version = '${{steps.get-version.outputs.version}}'
|
$version = '${{steps.get-version.outputs.version}}'
|
||||||
$date = '${{steps.get-date.outputs.date}}'
|
$date = '${{steps.get-date.outputs.date}}'
|
||||||
$message = '${{steps.get-commit-message.outputs.message}}'
|
$messagePath = $env:messagePath
|
||||||
$changelogPath = "CHANGELOG.md"
|
$changelogPath = "CHANGELOG.md"
|
||||||
|
|
||||||
|
# Read commit description content
|
||||||
|
$messageLines = Get-Content -Path $messagePath
|
||||||
|
|
||||||
# Read CHANGELOG.md content
|
# Read CHANGELOG.md content
|
||||||
$changelog = Get-Content -Path $changelogPath
|
$changelog = Get-Content -Path $changelogPath
|
||||||
|
|
||||||
# Split the message into individual items, trim whitespace, and format
|
# Remove empty lines from the message
|
||||||
$messageArray = $message -split '-' | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne "" }
|
$message = ($messageLines | Where-Object { $_ -ne "" }) -join "`n"
|
||||||
|
|
||||||
# Format each item to have a leading dash
|
|
||||||
$message = ($messageArray | ForEach-Object { "- $_" }) -join "`n"
|
|
||||||
|
|
||||||
# Check if the version already exists
|
# Check if the version already exists
|
||||||
if ($changelog -match "## \[$version\]") {
|
if ($changelog -match "## \[$version\]") {
|
||||||
|
Loading…
Reference in New Issue
Block a user