ci(forgejo): shorten release notes to since-last-tag + cap

- Build What's Changed from previous v* tag..HEAD only (not upstream..HEAD).
- List at most 50 newest commits with pointer to Full Changelog compare.
- Drop fork-delta footer block to reduce scrolling.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
littlecodedragon 2026-05-11 06:57:58 +02:00
parent c15d280cb4
commit f91af6fc72

View file

@ -112,11 +112,11 @@ jobs:
git fetch --no-tags --depth=1 "https://github.com/${upstream_repo}.git" "$upstream_base" || true git fetch --no-tags --depth=1 "https://github.com/${upstream_repo}.git" "$upstream_base" || true
fi fi
use_fork_merge_split=0 # Release notes: only commits since the *previous release tag* (short, correct scope).
# Do not use upstream_base..HEAD here — that lists the whole fork delta and is huge.
changelog_commit_limit=50
log_range="" log_range=""
if [ -n "$upstream_base" ] && git cat-file -e "${upstream_base}^{commit}" 2>/dev/null; then if [ -n "$previous_tag" ]; then
use_fork_merge_split=1
elif [ -n "$previous_tag" ]; then
log_range="${previous_tag}..HEAD" log_range="${previous_tag}..HEAD"
fi fi
@ -209,37 +209,22 @@ jobs:
[ "$any" -eq 1 ] [ "$any" -eq 1 ]
} }
if [ "$use_fork_merge_split" -eq 1 ]; then if [ -n "$log_range" ]; then
{ total_in_range="$(git rev-list --count "${log_range}" 2>/dev/null || printf '0')"
printf '%s\n' "#### Fork changes" ""
clear_buckets
fill_buckets_from_git "${upstream_base}..HEAD" --no-merges
if [ ${#new_lines[@]} -eq 0 ] && [ ${#fix_lines[@]} -eq 0 ] && [ ${#improve_lines[@]} -eq 0 ] && [ ${#other_lines[@]} -eq 0 ]; then
printf '%s\n' "_No direct commits in this range._" ""
else
emit_buckets_from_arrays
fi
clear_buckets
fill_buckets_from_git "${upstream_base}..HEAD" --merges
if [ ${#new_lines[@]} -gt 0 ] || [ ${#fix_lines[@]} -gt 0 ] || [ ${#improve_lines[@]} -gt 0 ] || [ ${#other_lines[@]} -gt 0 ]; then
printf '%s\n' "#### Merge commits" ""
emit_buckets_from_arrays
printf '\n'
fi
} > "${commit_log_file}"
elif [ -n "$log_range" ]; then
clear_buckets clear_buckets
fill_buckets_from_git "$log_range" fill_buckets_from_git "$log_range" "-n${changelog_commit_limit}"
{ {
if emit_buckets_from_arrays; then if emit_buckets_from_arrays; then
: if [ "${total_in_range}" -gt "${changelog_commit_limit}" ] 2>/dev/null; then
printf '%s\n' "" "_Showing the ${changelog_commit_limit} most recent commits since ${previous_tag}._" \
"_Older commits in this release: use **Full Changelog** below._" ""
fi
else else
printf '%s\n' "##### Other" "" "- Initial release" "" printf '%s\n' "##### Other" "" "- No commit messages in this tag range." ""
fi fi
} > "${commit_log_file}" } > "${commit_log_file}"
else else
printf '%s\n' "##### Other" "" "- Initial release" "" > "${commit_log_file}" printf '%s\n' "##### Other" "" "- First release tag, or no prior \`v*\` tag found — see repository history." "" > "${commit_log_file}"
fi fi
# Do not pass multiline commit text via step outputs / env (breaks some Forgejo/act_runner # Do not pass multiline commit text via step outputs / env (breaks some Forgejo/act_runner
@ -421,9 +406,6 @@ jobs:
VERSION_TAG: ${{ steps.prepare.outputs.VERSION_TAG }} VERSION_TAG: ${{ steps.prepare.outputs.VERSION_TAG }}
VERSION_DISPLAY: ${{ steps.prepare.outputs.VERSION_DISPLAY }} VERSION_DISPLAY: ${{ steps.prepare.outputs.VERSION_DISPLAY }}
PREV_TAG_NAME: ${{ steps.prepare.outputs.PREV_TAG_NAME }} PREV_TAG_NAME: ${{ steps.prepare.outputs.PREV_TAG_NAME }}
UPSTREAM_REPO: ${{ steps.prepare.outputs.UPSTREAM_REPO }}
UPSTREAM_REF: ${{ steps.prepare.outputs.UPSTREAM_REF }}
UPSTREAM_BASE: ${{ steps.prepare.outputs.UPSTREAM_BASE }}
REPO_URL: ${{ github.server_url }}/${{ github.repository }} REPO_URL: ${{ github.server_url }}/${{ github.repository }}
REPOSITORY_NAME: ${{ github.repository }} REPOSITORY_NAME: ${{ github.repository }}
FORGEJO_CURL_INSECURE: "true" FORGEJO_CURL_INSECURE: "true"
@ -522,10 +504,6 @@ jobs:
if [ -n "${PREV_TAG_NAME:-}" ]; then if [ -n "${PREV_TAG_NAME:-}" ]; then
full_changelog="**Full Changelog**: [${REPOSITORY_NAME}@${PREV_TAG_NAME}...${VERSION_TAG}](${REPO_URL}/compare/${PREV_TAG_NAME}...${VERSION_TAG})" full_changelog="**Full Changelog**: [${REPOSITORY_NAME}@${PREV_TAG_NAME}...${VERSION_TAG}](${REPO_URL}/compare/${PREV_TAG_NAME}...${VERSION_TAG})"
fi fi
fork_delta_label=""
if [ -n "${UPSTREAM_BASE:-}" ] && [ -n "${UPSTREAM_REF:-}" ]; then
fork_delta_label="Fork delta vs ${UPSTREAM_REPO}@${UPSTREAM_REF} (${UPSTREAM_BASE})"
fi
release_body_file="$(mktemp)" release_body_file="$(mktemp)"
{ {
@ -533,13 +511,11 @@ jobs:
"#### What's Changed" \ "#### What's Changed" \
"" \ "" \
"${commit_logs}" \ "${commit_logs}" \
"" \ ""
"##### Based on" \ if [ -n "${full_changelog}" ]; then
"" \ printf '%s\n' "${full_changelog}" ""
"${fork_delta_label}" \ fi
"" \ printf '%s\n' \
"${full_changelog}" \
"" \
"<!-->" \ "<!-->" \
"> [!TIP]" \ "> [!TIP]" \
">" \ ">" \