File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 5959 PACKAGE : " ${{ inputs.package == 'true' && 'ON' || 'OFF' }}"
6060 # GitHub creates merge commits for pull requests, so we need to use `github.event.pull_request.head.sha`
6161 # to get the actual commit SHA of the PR branch.
62+ GITHUB_REF_NAME : " ${{ github.ref_name }}"
6263 GITHUB_HEAD_SHA : " ${{ github.event.pull_request.head.sha || github.sha }}"
6364 run : |
6465 cmake \
Original file line number Diff line number Diff line change @@ -24,17 +24,17 @@ else ()
2424 OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY
2525 )
2626
27- set (GIT_COMMAND branch --show-current)
28- execute_process (
29- COMMAND ${GIT_EXECUTABLE} ${GIT_COMMAND} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE BRANCH
30- OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY
31- )
32-
33- if (DEFINED ENV{GITHUB_HEAD_SHA})
34- # GitHub creates merge commits for pull requests, so we need to use `github.event.pull_request.head.sha` to get the
35- # actual commit SHA of the PR branch. We set $GITHUB_HEAD_SHA in the cmake action
27+ if (DEFINED ENV{GITHUB_CI})
28+ # GitHub in PR doesn't: - keep branch name - run from commit pushed to branch
29+ set (BRANCH $ENV{GITHUB_REF_NAME} )
3630 set (REV $ENV{GITHUB_HEAD_SHA} )
3731 else ()
32+ set (GIT_COMMAND branch --show-current)
33+ execute_process (
34+ COMMAND ${GIT_EXECUTABLE} ${GIT_COMMAND} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE BRANCH
35+ OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY
36+ )
37+
3838 set (GIT_COMMAND rev-parse --short HEAD)
3939 execute_process (
4040 COMMAND ${GIT_EXECUTABLE} ${GIT_COMMAND} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE REV
You can’t perform that action at this time.
0 commit comments