Prechádzať zdrojové kódy

github: fix scripts/check-* [skip ci]

* fetch ref previous commit too
* add FETCH_DEPTH value so is more visible
Victor Seva 5 mesiacov pred
rodič
commit
3e1b0c026b

+ 2 - 0
.github/scripts/check-cmake-format.sh

@@ -39,6 +39,8 @@ else
 fi
 
 ref=${ref:-HEAD}
+# Ensure that the ref revision has some history
+git fetch -q "--depth=${FETCH_DEPTH:-50}" origin "+${ref}"
 src_sha=$(git rev-parse -q --verify "${ref}") || die "fatal: couldn't find ref ${ref}"
 echo "Checking $(git rev-list --count "${src_sha}" "^${target_sha}") commits since revision ${target_sha}"
 for commit in $(git rev-list --reverse "${src_sha}" "^${target_sha}"); do

+ 2 - 0
.github/scripts/check-commit.sh

@@ -72,6 +72,8 @@ else
 fi
 
 ref=${ref:-HEAD}
+# Ensure that the ref revision has some history
+git fetch -q "--depth=${FETCH_DEPTH:-50}" origin "+${ref}"
 src_sha=$(git rev-parse -q --verify "${ref}") || die "fatal: couldn't find ref ${ref}"
 echo "Checking $(git rev-list --count "${src_sha}" "^${target_sha}") commits since revision ${target_sha}"
 for commit in $(git rev-list --reverse "${src_sha}" "^${target_sha}"); do

+ 2 - 0
.github/workflows/pull_request.yml

@@ -34,6 +34,7 @@ jobs:
         run: ./.github/scripts/check-cmake-format.sh
         env:
           ref: ${{ github.event.pull_request.head.sha }}
+          FETCH_DEPTH: 50
   check-commit:
     runs-on: ubuntu-latest
     permissions:
@@ -47,6 +48,7 @@ jobs:
         run: ./.github/scripts/check-commit.sh
         env:
           ref: ${{ github.event.pull_request.head.sha }}
+          FETCH_DEPTH: 50
   build:
     runs-on: ubuntu-latest
     permissions: