Przeglądaj źródła

CI: Fix checkers tripping over empty GitHub Actions references

When the internal git reference is nonexistent, GitHub Actions seems
to convert that value into a hash made up of only zeroes. As that
hash will be commit-ish it will pass verification.

git cat-file will fail if the provided reference cannot be resolved
in the repository so should be the safer choice.
PatTheMav 2 lat temu
rodzic
commit
ea8ea39e29

+ 1 - 1
.github/actions/check-changes/action.yaml

@@ -38,7 +38,7 @@ runs:
         shopt -s extglob
         shopt -s dotglob
 
-        if ! git rev-parse --verify ${GIT_BASE_REF} &> /dev/null; then
+        if ! git cat-file -e "${GIT_BASE_REF}" &> /dev/null; then
           echo "::warning::Provided base reference ${GIT_BASE_REF} is invalid"
           if [[ "${USE_FALLBACK}" == 'true' ]]; then
             GIT_BASE_REF='HEAD~1'

+ 1 - 1
.github/actions/qt-xml-validator/action.yaml

@@ -46,7 +46,7 @@ runs:
         shopt -s extglob
         shopt -s globstar
 
-        if ! git rev-parse --verify "${GITHUB_REF_BEFORE}" &> /dev/null; then
+        if ! git cat-file -e "${GITHUB_REF_BEFORE}" &> /dev/null; then
           GITHUB_REF_BEFORE='4b825dc642cb6eb9a060e54bf8d69288fbee4904'
         fi
 

+ 1 - 1
.github/actions/run-clang-format/action.yaml

@@ -43,7 +43,7 @@ runs:
         : Run clang-format 🐉
         if (( ${+RUNNER_DEBUG} )) setopt XTRACE
 
-        if ! git rev-parse --verify ${GITHUB_REF_BEFORE} &> /dev/null; then
+        if ! git cat-file -e ${GITHUB_REF_BEFORE} &> /dev/null; then
           GITHUB_REF_BEFORE='4b825dc642cb6eb9a060e54bf8d69288fbee4904'
         fi
 

+ 1 - 1
.github/actions/run-cmake-format/action.yaml

@@ -42,7 +42,7 @@ runs:
         : Run cmake-format 🎛️
         if (( ${+RUNNER_DEBUG} )) setopt XTRACE
 
-        if ! git rev-parse --verify ${GITHUB_REF_BEFORE} &> /dev/null; then
+        if ! git cat-file -e ${GITHUB_REF_BEFORE} &> /dev/null; then
           GITHUB_REF_BEFORE='4b825dc642cb6eb9a060e54bf8d69288fbee4904'
         fi
 

+ 1 - 1
.github/actions/run-swift-format/action.yaml

@@ -42,7 +42,7 @@ runs:
         : Run swift-format 🔥
         if (( ${+RUNNER_DEBUG} )) setopt XTRACE
 
-        if ! git rev-parse --verify ${GITHUB_REF_BEFORE} &> /dev/null; then
+        if ! git cat-file -e ${GITHUB_REF_BEFORE} &> /dev/null; then
           GITHUB_REF_BEFORE='4b825dc642cb6eb9a060e54bf8d69288fbee4904'
         fi