File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments