From 93d85b353553f0e796f75a0fff51f48cb917dd78 Mon Sep 17 00:00:00 2001 From: NiniOak Date: Wed, 23 Aug 2023 11:23:42 -0700 Subject: [PATCH] code review comments --- .../scripts/filter_changed_files_go_test.sh | 32 +++++++++---------- .github/workflows/go-tests.yml | 6 ++-- .github/workflows/test-integrations.yml | 6 ++-- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/scripts/filter_changed_files_go_test.sh b/.github/scripts/filter_changed_files_go_test.sh index efd4955293b69..0046a4c4949ab 100755 --- a/.github/scripts/filter_changed_files_go_test.sh +++ b/.github/scripts/filter_changed_files_go_test.sh @@ -12,22 +12,22 @@ trigger_ci=false # Loop through the changed files and find directories/files outside the skipped ones for file_to_check in $files_to_check; do - file_is_skipped=false - for dir in "${skipped_directories[@]}"; do - if [[ "$file_to_check" == "$dir"* ]] || [[ "$file_to_check" == *.md && "$dir" == *"/" ]]; then - file_is_skipped=true - break - fi - done - if [ "$file_is_skipped" = "false" ]; then - other_directories+="$(dirname "$file_to_check")\n" + file_is_skipped=false + for dir in "${skipped_directories[@]}"; do + if [[ "$file_to_check" == "$dir"* ]] || [[ "$file_to_check" == *.md && "$dir" == *"/" ]]; then + file_is_skipped=true + break + fi + done + if [ "$file_is_skipped" = "false" ]; then + other_directories+="$(dirname "$file_to_check")\n" trigger_ci=true - echo "One or more non doc file(s) changed: $trigger_ci" - echo -e $other_directories - echo "trigger-ci=$trigger_ci" >> "$GITHUB_OUTPUT" - exit 0 ## if file is outside of the skipped_directory exit loop - fi + echo "Non doc file(s) changed - skipped ci: $trigger_ci" + echo -e $other_directories + echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT" + exit 0 ## if file is outside of the skipped_directory exit script + fi done -echo "One or more non doc file(s) changed: $trigger_ci" -echo "trigger-ci=$trigger_ci" >> "$GITHUB_OUTPUT" \ No newline at end of file +echo "Only doc file(s) changed - skipped ci: $trigger_ci" +echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT" diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml index a34e9ab094927..9db458ed5d51d 100644 --- a/.github/workflows/go-tests.yml +++ b/.github/workflows/go-tests.yml @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-latest name: Get files changed and conditionally skip CI outputs: - files-changed: ${{ steps.read-files.outputs.trigger-ci }} + trigger-ci: ${{ steps.read-files.outputs.trigger-ci }} steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: @@ -40,7 +40,7 @@ jobs: setup: needs: [conditional-skip] name: Setup - if: needs.conditional-skip.outputs.files-changed == 'true' + if: needs.conditional-skip.outputs.trigger-ci == 'true' runs-on: ubuntu-latest outputs: compute-small: ${{ steps.setup-outputs.outputs.compute-small }} @@ -503,7 +503,7 @@ jobs: - go-test-32bit # - go-test-s390x runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }} - if: always() && needs.conditional-skip.outputs.files-changed == 'true' + if: always() && needs.conditional-skip.outputs.trigger-ci == 'true' steps: - name: evaluate upstream job results run: | diff --git a/.github/workflows/test-integrations.yml b/.github/workflows/test-integrations.yml index adde49b44fa63..71394bba918dd 100644 --- a/.github/workflows/test-integrations.yml +++ b/.github/workflows/test-integrations.yml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest name: Get files changed and conditionally skip CI outputs: - files-changed: ${{ steps.read-files.outputs.trigger-ci }} + trigger-ci: ${{ steps.read-files.outputs.trigger-ci }} steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: @@ -43,7 +43,7 @@ jobs: needs: [conditional-skip] runs-on: ubuntu-latest name: Setup - if: needs.conditional-skip.outputs.files-changed == 'true' + if: needs.conditional-skip.outputs.trigger-ci == 'true' outputs: compute-small: ${{ steps.runners.outputs.compute-small }} compute-medium: ${{ steps.runners.outputs.compute-medium }} @@ -583,7 +583,7 @@ jobs: - compatibility-integration-test - peering_commontopo-integration-test runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }} - if: always() && needs.conditional-skip.outputs.files-changed == 'true' + if: always() && needs.conditional-skip.outputs.trigger-ci == 'true' steps: - name: evaluate upstream job results run: |