Skip to content

Commit 94170f6

Browse files
Remove the g
1 parent a4c41e0 commit 94170f6

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/generate-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
echo "Version: \`${PROJECT_NUMBER}\`"
107107
echo ""
108108
echo "> Note: On a non-tag/release run, the version will resolve to:"
109-
echo " \`<closest tag>-<commits since tag>-g<commit sha>\`"
109+
echo " \`<closest tag>-<commits since tag>-<commit sha>\`"
110110
} >>"$GITHUB_STEP_SUMMARY"
111111
112112
- name: Verify docs were generated

scripts/generate-docs.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ elif [[ -z "$project_number" ]]; then
8181
described=""
8282
fi
8383

84+
# git describe emits "<tag>-<n>-g<sha>[-dirty]" when HEAD is past the
85+
# nearest ancestor tag. The leading 'g' on the abbreviated SHA is a
86+
# git-describe convention (it once signified the originating SCM back
87+
# when SVN/Hg interop mattered) and adds nothing for human readers of
88+
# the docs version banner. Strip it so the rendered version reads as
89+
# the more obvious "<tag>-<n>-<sha>[-dirty]". Untagged --always
90+
# output (bare SHA) and on-tag output (no -<n>-g segment) are left
91+
# untouched by this regex.
92+
if [[ "$described" =~ ^(.+-[0-9]+)-g([0-9a-f]+)(.*)$ ]]; then
93+
described="${BASH_REMATCH[1]}-${BASH_REMATCH[2]}${BASH_REMATCH[3]}"
94+
fi
95+
8496
if [[ -z "$described" ]]; then
8597
project_number="v0.0.0-dev"
8698
elif [[ "$described" == v* ]]; then

0 commit comments

Comments
 (0)