mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat: Implement fallback to commit messages in changelog if empty
This commit is contained in:
39
.github/workflows/release.yml
vendored
39
.github/workflows/release.yml
vendored
@@ -1898,12 +1898,49 @@ jobs:
|
||||
configuration: "./Scripts/Release/ChangelogConfig.json"
|
||||
- run: echo "Changelog:"
|
||||
- run: echo "${{steps.build_changelog.outputs.changelog}}"
|
||||
- name: Fallback to commit messages if changelog empty
|
||||
id: fallback_changelog
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
CHANGELOG_CONTENT="${{steps.build_changelog.outputs.changelog}}"
|
||||
OLD_PLACEHOLDER="No significant changes were made. We have just fixed minor bugs for this release. You can find the detailed information in the commit history."
|
||||
NEW_PLACEHOLDER="(auto) No categorized pull requests. Fallback will list raw commit messages."
|
||||
if echo "$CHANGELOG_CONTENT" | grep -Fq "$OLD_PLACEHOLDER" || echo "$CHANGELOG_CONTENT" | grep -Fq "$NEW_PLACEHOLDER"; then
|
||||
echo "Detected empty placeholder changelog. Building commit list fallback."
|
||||
# Find previous tag (skip the most recent tag which might be for an older release). If none, include all commits.
|
||||
if prev_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null); then
|
||||
echo "Previous tag: $prev_tag"
|
||||
commits=$(git log --pretty=format:'- %s (%h)' "$prev_tag"..HEAD)
|
||||
else
|
||||
echo "No previous tag found; using full commit history on this branch."
|
||||
commits=$(git log --pretty=format:'- %s (%h)')
|
||||
fi
|
||||
# If still empty (e.g., no commits), keep placeholder to avoid empty body.
|
||||
if [ -z "$commits" ]; then
|
||||
commits="(no commits found)"
|
||||
fi
|
||||
{
|
||||
echo "changelog<<'EOF'"
|
||||
echo "## Commit Messages"
|
||||
echo ""
|
||||
echo "$commits"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
# Pass through original changelog
|
||||
{
|
||||
echo "changelog<<'EOF'"
|
||||
echo "$CHANGELOG_CONTENT"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: "7.0.${{needs.generate-build-number.outputs.build_number}}"
|
||||
artifactErrorsFailBuild: true
|
||||
body: |
|
||||
${{steps.build_changelog.outputs.changelog}}
|
||||
${{steps.fallback_changelog.outputs.changelog}}
|
||||
|
||||
|
||||
infrastructure-agent-deploy:
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
},
|
||||
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>Changes</summary>\n\n#{{UNCATEGORIZED}}\n</details>",
|
||||
"pr_template": "- #{{TITLE}}\n - PR: ##{{NUMBER}}",
|
||||
"empty_template": "No significant changes were made. We have just fixed minor bugs for this release. You can find the detailed information in the commit history.",
|
||||
"empty_template": "(auto) No categorized pull requests. Fallback will list raw commit messages.",
|
||||
"label_extractor": [
|
||||
{
|
||||
"pattern": "(.) (.+)",
|
||||
|
||||
Reference in New Issue
Block a user