diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 590da62ff..38b33f547 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,7 +72,7 @@ jobs: shell: bash run: __test__/verify-side-by-side.sh - # Sparse checkout + # Sparse checkout - name: Sparse checkout uses: ./ with: @@ -82,9 +82,7 @@ jobs: dist path: sparse-checkout - - name: Verify sparse checkout basic - run: __test__/verify-sparse-checkout-basic.sh - - name: Verify sparse checkout example + - name: Verify sparse checkout run: __test__/verify-sparse-checkout.sh # LFS diff --git a/__test__/verify-sparse-checkout-basic.sh b/__test__/verify-sparse-checkout-basic.sh deleted file mode 100755 index f8085f40d..000000000 --- a/__test__/verify-sparse-checkout-basic.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Verify .git folder -if [ ! -d "./sparse-checkout/.git" ]; then - echo "Expected ./sparse-checkout/.git folder to exist" - exit 1 -fi - -# Verify sparse-checkout basic -cd sparse-checkout - -SPARSE=$(git sparse-checkout list) - -if [ "$?" != "0" ]; then - echo "Failed to validate sparse-checkout" - exit 1 -fi - -# Check that sparse-checkout list is not empty -if [ -z "$SPARSE" ]; then - echo "Expected sparse-checkout list to not be empty" - exit 1 -fi - -# Check that all folders from sparse-checkout exists -for pattern in $(git sparse-checkout list) -do - if [ ! -d "$pattern" ]; then - echo "Expected directory '$pattern' to exist" - exit 1 - fi -done \ No newline at end of file diff --git a/__test__/verify-sparse-checkout.sh b/__test__/verify-sparse-checkout.sh index b0dd06000..e76b58445 100755 --- a/__test__/verify-sparse-checkout.sh +++ b/__test__/verify-sparse-checkout.sh @@ -9,6 +9,28 @@ fi # Verify sparse-checkout cd sparse-checkout +SPARSE=$(git sparse-checkout list) + +if [ "$?" != "0" ]; then + echo "Failed to validate sparse-checkout" + exit 1 +fi + +# Check that sparse-checkout list is not empty +if [ -z "$SPARSE" ]; then + echo "Expected sparse-checkout list to not be empty" + exit 1 +fi + +# Check that all folders of the sparse checkout exist +for pattern in $SPARSE +do + if [ ! -d "$pattern" ]; then + echo "Expected directory '$pattern' to exist" + exit 1 + fi +done + checkSparse () { if [ ! -d "./$1" ]; then echo "Expected directory '$1' to exist" @@ -24,12 +46,12 @@ checkSparse () { done } -# Check that all folders and its childrens has been fetched correctly +# Check that all folders and their children have been checked out checkSparse __test__ checkSparse .github checkSparse dist -# Check that only sparse-checkout folders has been fetched +# Check that only sparse-checkout folders have been checked out for pattern in $(git ls-tree --name-only HEAD) do if [ -d "$pattern" ]; then diff --git a/action.yml b/action.yml index bb7451ed2..d0c96b1e0 100644 --- a/action.yml +++ b/action.yml @@ -56,7 +56,7 @@ inputs: sparse-checkout: description: > Do a sparse checkout on given patterns. - Each pattern should be sepparated with new lines + Each pattern should be separated with new lines default: null fetch-depth: description: 'Number of commits to fetch. 0 indicates all history for all branches and tags.'