From 7cf246edc68c02e4def05b83fe7f7365cc1c24b8 Mon Sep 17 00:00:00 2001 From: Sumanth Reddy Chinna Pullaiah Date: Wed, 6 Mar 2024 21:56:51 +0000 Subject: [PATCH] test --- .github/workflows/get-changed-files.yml | 35 ++++++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/get-changed-files.yml b/.github/workflows/get-changed-files.yml index 31b0a04d0..79bb42c71 100644 --- a/.github/workflows/get-changed-files.yml +++ b/.github/workflows/get-changed-files.yml @@ -15,15 +15,30 @@ jobs: with: fetch-depth: 0 - - name: Modified files + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v42 + with: + json: true + sha: 'origin main' + # NOTE: `since_last_remote_commit: true` is implied by default and falls back to the previous local commit. + + - name: List all changed files + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | - git fetch origin main:main - git diff --name-only --diff-filter=d main~ main + set -eux + for file in ${ALL_CHANGED_FILES}; do + echo "$file was changed" + done - # - name: Setup test matrix scenarios - # id: setup-matrix-scenarios - # run: | - # set -eux - # matrix=$(echo "${ALL_CHANGED_FILES}" | awk -F'/' '{split($3, file_name, "."); split(file_name[1], cloud_region, "-");region= (length(cloud_region) > 1) ? substr($3, index($3, "-") + 1) : ""; cloud=cloud_region[1]; gsub(".json", "", region); print "{\"cloud\": \"" cloud "\", \"file_name\": \"" file_name[1] "\", " (region != "" ? "\"region\": \"" region "\", " : "") "\"scenario_type\": \"" $1 "\", \"scenario_name\": \"" $2 "\"},"}' | sort | uniq | sed 's/,$/,/') - # matrix="${matrix//$'\n'/''}" - # echo "matrix_combinations={\"include\": [${matrix%?}]}" >> "$GITHUB_OUTPUT" + - name: Setup test matrix scenarios + id: setup-matrix-scenarios + run: | + set -eux + matrix=$(echo "${ALL_CHANGED_FILES}" | awk -F'/' '{split($3, file_name, "."); split(file_name[1], cloud_region, "-");region= (length(cloud_region) > 1) ? substr($3, index($3, "-") + 1) : ""; cloud=cloud_region[1]; gsub(".json", "", region); print "{\"cloud\": \"" cloud "\", \"file_name\": \"" file_name[1] "\", " (region != "" ? "\"region\": \"" region "\", " : "") "\"scenario_type\": \"" $1 "\", \"scenario_name\": \"" $2 "\"},"}' | sort | uniq | sed 's/,$/,/') + matrix="${matrix//$'\n'/''}" + echo "matrix_combinations={\"include\": [${matrix%?}]}" >> "$GITHUB_OUTPUT" + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + \ No newline at end of file