File tree Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change 48
48
echo OUTPUT_FILENAME="${filename}" >> "$GITHUB_OUTPUT"
49
49
echo output filename: ${filename}
50
50
51
- # For pull requests, check out the head ref of the source branch from the source repo.
52
51
- name : Checkout
53
- if : inputs.workflow == 'pr'
54
- uses : actions/checkout@v4
55
- with :
56
- ref : ${{ github.head_ref }}
57
- repository : ${{ github.event.pull_request.head.repo.full_name }}
58
- fetch-depth : 0
59
- fetch-tags : true
60
- # For other workflows, check out the requested revision (which defaults to
61
- # head of the default branch).
62
- - name : Checkout
63
- if : inputs.workflow != 'pr'
64
52
uses : actions/checkout@v4
65
53
with :
66
54
ref : ${{ inputs.revision }}
Original file line number Diff line number Diff line change 245
245
# figure out git version and revision if needed.
246
246
EXTRA_PANDOC_OPTIONS=" "
247
247
if test " ${DO_GITVERSION} " == " yes" ; then
248
+ if [ ! -z " ${PR_NUMBER} " ] && $( git rev-parse HEAD^2 > /dev/null 2> /dev/null) ; then
249
+ # For PR workflows, base the version info on the right parent.
250
+ # In the context of a GitHub pull request, HEAD is a merge commit where
251
+ # parent1 (HEAD^1) is the target branch and parent2 (HEAD~2) is the source
252
+ GIT_COMMIT=$( git rev-parse --short HEAD^2)
253
+ else
254
+ # Otherwise, base the version info on HEAD.
255
+ GIT_COMMIT=$( git rev-parse --short HEAD)
256
+ fi
257
+
248
258
# TODO: Should we fail if dirty?
249
259
raw_version=" $( git describe --always --tags) "
250
260
echo " Git version: ${raw_version} "
@@ -263,7 +273,6 @@ if test "${DO_GITVERSION}" == "yes"; then
263
273
# Where $REVISION is the number of commits since the last tag (e.g., 54)
264
274
# $VERSION-$REVISION-g$COMMIT --> version without prerelease tag at a particular commit (len 3)
265
275
# $VERSION-$PRERELEASE-$REVISION-g$COMMIT --> version with (len 4)
266
- GIT_COMMIT=$( git rev-parse --short HEAD)
267
276
len=${# dash_hunks[@]}
268
277
case $len in
269
278
1)
You can’t perform that action at this time.
0 commit comments