Add link to git commit for unstable changelog too (#2078)

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille 2025-03-05 10:43:27 +01:00 committed by GitHub
parent 844dd6f8ae
commit 4ff9a851e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 3 deletions

View file

@ -0,0 +1 @@
Add link to the git commit for the unstable changelog.

View file

@ -31,9 +31,17 @@
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
<table class="release-info"> <table class="release-info">
{{ if ne $version "unstable" -}} {{ $rev := $version }}
{{ $commitLink := printf "https://github.com/matrix-org/matrix-spec/tree/%s" $version -}} {{ if eq $version "unstable" -}}
{{- /*
Extract the git SHA from the frontmatter of the changelog, where
it was stashed by `generate-changelog.sh`.
*/ -}}
{{ $rev = .Params.commit -}}
{{ end -}}
{{ $commitLink := printf "https://github.com/matrix-org/matrix-spec/tree/%s" $rev -}}
<tr><th>Git commit</th><td><a href="{{ $commitLink }}">{{ $commitLink }}</a></td> <tr><th>Git commit</th><td><a href="{{ $commitLink }}">{{ $commitLink }}</a></td>
{{ if ne $version "unstable" }}
<tr><th>Release date</th><td>{{ .Date | time.Format ":date_long" }}</td> <tr><th>Release date</th><td>{{ .Date | time.Format ":date_long" }}</td>
{{ end -}} {{ end -}}
{{ $checklist := .OutputFormats.Get "checklist" -}} {{ $checklist := .OutputFormats.Get "checklist" -}}

View file

@ -44,8 +44,18 @@ outputs:
- html - html
- checklist - checklist
date: $(date -Idate) date: $(date -Idate)
---
EOF EOF
# Add the commit hash for the unstable versions. It is used to generate a
# link to the commit on the repository.
if [ "$VERSION" == "vUNSTABLE" ]; then
echo "params:"
echo " commit: $(git rev-parse --short HEAD)"
fi
# Close the frontmatter.
echo "---"
# Remove trailing whitespace (such as our intentionally blank RST headings) # Remove trailing whitespace (such as our intentionally blank RST headings)
sed -e "s/[ ]*$//" rendered.md sed -e "s/[ ]*$//" rendered.md
} > ../content/changelog/$FILENAME } > ../content/changelog/$FILENAME