diff --git a/.github/scripts/changed_files.sh b/.github/scripts/changed_files.sh deleted file mode 100755 index 48b3e37ff7be3..0000000000000 --- a/.github/scripts/changed_files.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# Get the list of changed files -changed_files=$(git diff --name-only origin/$GITHUB_BASE_REF) - -# Define the directories to check -allowed_directories=("docs/" "ui/" "website/" "grafana/" ".github/") - -# Initialize a variable to track directories outside the specified ones -other_directories="" - -# Loop through the changed files and find directories outside the allowed ones -for file in $changed_files; do - is_allowed=false - for dir in "${allowed_directories[@]}"; do - if [[ "$file" == "$dir"* ]] || [[ "$file" == *.md && "$dir" == *"/" ]]; then - is_allowed=true - break - fi - done - if [ "$is_allowed" = "false" ]; then - other_directories+="$(dirname "$file")\n" - fi -done - -# If there are directories outside the specified ones, trigger the workflow -if [ -n "$other_directories" ]; then - echo "One or more non doc file(s) changed: true" - echo -e $other_directories - echo "trigger-ci=true" >> "$GITHUB_OUTPUT" -else - echo "One or more non doc file(s) changed: false" - echo "trigger-ci=false" >> "$GITHUB_OUTPUT" -fi diff --git a/.github/scripts/filter_changed_files_go_test.sh b/.github/scripts/filter_changed_files_go_test.sh new file mode 100755 index 0000000000000..2050f2f3a8d67 --- /dev/null +++ b/.github/scripts/filter_changed_files_go_test.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Get the list of changed files +files_to_check=$(git diff --name-only origin/$GITHUB_BASE_REF) + +# Define the directories to check +skipped_directories=("docs/" "ui/" "website/" "grafana/" ".github/") + +# Initialize a variable to track directories outside the skipped ones +other_directories="" +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" + trigger_ci=true + echo "One or more non doc file(s) changed: true" + echo -e $other_directories + echo "trigger-ci=$trigger_ci" >> "$GITHUB_OUTPUT" + exit 0 ## if file is outside of the skipped_directory exit loop + fi +done + +echo "One or more non doc file(s) changed: false" +echo "trigger-ci=$trigger_ci" >> "$GITHUB_OUTPUT" \ No newline at end of file diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml index 7dc31ba8d4088..a34e9ab094927 100644 --- a/.github/workflows/go-tests.yml +++ b/.github/workflows/go-tests.yml @@ -26,16 +26,16 @@ env: jobs: conditional-skip: runs-on: ubuntu-latest - name: Get files changed and condtionally skip CI + name: Get files changed and conditionally skip CI outputs: files-changed: ${{ steps.read-files.outputs.trigger-ci }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: fetch-depth: 0 - - name: Get all docs, ui and github files that have changed + - name: Get changed files id: read-files - run: ./.github/scripts/changed_files.sh + run: ./.github/scripts/filter_changed_files_go_test.sh setup: needs: [conditional-skip] diff --git a/.github/workflows/test-integrations.yml b/.github/workflows/test-integrations.yml index ecb03ed119a5b..adde49b44fa63 100644 --- a/.github/workflows/test-integrations.yml +++ b/.github/workflows/test-integrations.yml @@ -32,12 +32,12 @@ jobs: outputs: files-changed: ${{ steps.read-files.outputs.trigger-ci }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: fetch-depth: 0 - - name: Get all docs, ui and github files that have changed + - name: Get changed files id: read-files - run: ./.github/scripts/changed_files.sh + run: ./.github/scripts/filter_changed_files_go_test.sh setup: needs: [conditional-skip] diff --git a/test-integ/peering_commontopo/ac1_basic_test.go b/test-integ/peering_commontopo/ac1_basic_test.go index 85aaee4e6b55b..6c4500a620788 100644 --- a/test-integ/peering_commontopo/ac1_basic_test.go +++ b/test-integ/peering_commontopo/ac1_basic_test.go @@ -13,6 +13,7 @@ import ( ) type ac1BasicSuite struct { + // test comment // inputs DC string Peer string