From 640fa984805da817c091aa9e64b4b7595d221b37 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Thu, 30 Jul 2020 20:20:41 -0400 Subject: [PATCH 1/4] Update action.yml --- action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index edc4b80..ee0ddc6 100644 --- a/action.yml +++ b/action.yml @@ -7,9 +7,8 @@ inputs: required: true default: ${{ github.token }} files: - description: Comma separated list of files to check for changes. - required: false - default: '' + description: List of files to check for changes. + required: true runs: using: 'docker' image: 'Dockerfile' From 66fc0a5cefcb65d2f22701e3dd3d743f7667ae5e Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Thu, 30 Jul 2020 20:40:31 -0400 Subject: [PATCH 2/4] Update entrypoint.sh --- entrypoint.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index a299a67..0658a16 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,11 +5,16 @@ set -e GITHUB_TOKEN=$1 FILES=$2 -echo "Formatting filenames..." -EXPECTED_FILES="$(printf $(echo ${FILES} | sed 's| ||g' | sed 's/,/|/g'))" +CHANGED_FILES=() -echo "Checking changes for \"${EXPECTED_FILES}\"... " -CHANGED_FILES=$(git diff --diff-filter=ACM --name-only | grep -E "(${EXPECTED_FILES})" || true) +for path in ${FILES} +do + echo "Checking for file changes: \"${path}\"..." + MODIFIED_FILE=$(git diff --diff-filter=ACM --name-only | grep -E "(${path})" || true) + if [[ ! -z ${MODIFIED_FILE} ]]; then + CHANGED_FILES+=("${path}") + fi +done if [[ -z ${CHANGED_FILES} ]]; then echo "::set-output name=files_changed::false" From 6aa0bacae5ad68a8c41345adc27532bbd47a6877 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Thu, 30 Jul 2020 20:41:40 -0400 Subject: [PATCH 3/4] Create test.yml --- .github/workflows/test.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1d52e07 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,19 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + name: Test verify-changed-files + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: shellcheck + uses: reviewdog/action-shellcheck@v1 From 7bb0d4f63d522753f25b32f8841cdb84f92abdcb Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Thu, 30 Jul 2020 20:43:24 -0400 Subject: [PATCH 4/4] Update entrypoint.sh --- entrypoint.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 0658a16..e7635f4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,7 +2,6 @@ set -e -GITHUB_TOKEN=$1 FILES=$2 CHANGED_FILES=() @@ -11,7 +10,7 @@ for path in ${FILES} do echo "Checking for file changes: \"${path}\"..." MODIFIED_FILE=$(git diff --diff-filter=ACM --name-only | grep -E "(${path})" || true) - if [[ ! -z ${MODIFIED_FILE} ]]; then + if [[ -n ${MODIFIED_FILE} ]]; then CHANGED_FILES+=("${path}") fi done