From 7d84038c21425c8e55a886c962ae3849f78ddd66 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 4 Apr 2021 12:14:11 -0400 Subject: [PATCH 1/3] Update entrypoint.sh --- entrypoint.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 3ec5ba8..b614c51 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,6 +8,12 @@ for path in ${INPUT_FILES} do echo "Checking for file changes: \"${path}\"..." MODIFIED_FILE=$(git diff --diff-filter=ACMUXTR --name-only | grep -E "(${path})" || true) + + if [[ -z $MODIFIED_FILE ]]; then + # Find unstaged changes + MODIFIED_FILE=$(git status --porcelain | awk '{ print $2 }' | grep -E "(${path})" || true) + fi + if [[ -n ${MODIFIED_FILE} ]]; then echo "Found uncommited changes at: ${path}" CHANGED_FILES+=("${path}") From d3843fc0959fce0338e9d63f111168b95dc4f311 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 4 Apr 2021 12:20:23 -0400 Subject: [PATCH 2/3] Update test.yml --- .github/workflows/test.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1512419..e6ff121 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,3 +55,21 @@ jobs: run: | echo "No Changes found: (Not expected)" exit 1 + - name: Generate and unstaged file + run: | + echo "New changes" > unstaged.txt + - name: Test unstaged file has changes + uses: ./ + id: changed_unstaged_files_expected + with: + files: | + unstaged.txt + - name: Display unstaged changed files + if: steps.changed_unstaged_files_expected.outputs.files_changed == 'true' + run: | + echo "Changed files: ${{ steps.changed_unstaged_files_expected.outputs.changed_files }}" + - name: Verify Changes to test/new.txt + if: steps.changed_files_expected.outputs.files_changed != 'true' + run: | + echo "No Changes found: (Not expected)" + exit 1 From 70c9d4c926d0ac1aab0559934301a98013952339 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 4 Apr 2021 12:33:33 -0400 Subject: [PATCH 3/3] Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6ff121..78b3511 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,8 +68,8 @@ jobs: if: steps.changed_unstaged_files_expected.outputs.files_changed == 'true' run: | echo "Changed files: ${{ steps.changed_unstaged_files_expected.outputs.changed_files }}" - - name: Verify Changes to test/new.txt - if: steps.changed_files_expected.outputs.files_changed != 'true' + - name: Verify Changes to unstaged.txt + if: steps.changed_unstaged_files_expected.outputs.files_changed != 'true' run: | echo "No Changes found: (Not expected)" exit 1