File tree Expand file tree Collapse file tree 2 files changed +60
-1
lines changed
Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Check for Changes
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ base-sha :
7+ required : true
8+ type : string
9+ head-sha :
10+ required : true
11+ type : string
12+ excluded-dirs :
13+ required : false
14+ type : array
15+ default : ['docs/**', 'community/**', 'examples/**']
16+
17+ jobs :
18+ check-changes :
19+ runs-on : ubuntu-latest
20+ outputs :
21+ skip_tests : ${{ steps.check_changes.outputs.skip_tests}}
22+
23+ steps :
24+ - name : Checkout code
25+ uses : actions/checkout@v4
26+ with :
27+ fetch-depth : 2
28+ ref : ${{ inputs.head-sha }}
29+
30+ - name : Check for excluded directory changes
31+ id : check_changes
32+ run : |
33+ CHANGED_FILES=$(git diff --name-only ${{ inputs.base-sha }} ${{ inputs.head-sha }})
34+ echo "Changed files:"
35+ echo "$CHANGED_FILES"
36+
37+ # Join the excluded directories into a single pattern
38+ EXCLUDE_PATTERN=$(IFS='|'; echo "${{ inputs.excluded-dirs[*] }}")
39+
40+ # Check if any changed file matches the exclusion patterns
41+ NON_EXCLUDED_CHANGED=$(echo "$CHANGED_FILES" | grep -Ev "^($EXCLUDE_PATTERN)" || true)
42+
43+ if [[ -z "$NON_EXCLUDED_CHANGED" ]]; then
44+ echo "skip_tests=true" >> "$GITHUB_ENV"
45+ echo "::set-output name=skip_tests::true"
46+ else
47+ echo "skip_tests=false" >> "$GITHUB_ENV"
48+ echo "::set-output name=skip_tests::false"
49+ fi
50+
Original file line number Diff line number Diff line change 44 pull_request :
55
66jobs :
7+ check-changes :
8+ uses : ./.github/workflows/check_skip_tests.yml
9+ with :
10+ base-sha : ${{ github.event.pull_request.base.sha }}
11+ head-sha : ${{ github.event.pull_request.head.sha }}
12+ excluded-dirs : ['docs/**', 'community/**', 'examples/**']
13+ id : check_changes
14+
715 unit-test-python :
8- if : ${{ !contains(github.event.pull_request.files, 'docs/') }} # Skip if docs files changed
16+ if : ${{ steps.check_changes.outputs.skip-tests == 'false' }}
917 runs-on : ${{ matrix.os }}
1018 strategy :
1119 fail-fast : false
4351 run : uv cache prune --ci
4452
4553 unit-test-ui :
54+ if : ${{ steps.check_changes.outputs.skip-tests == 'false' }}
4655 runs-on : ubuntu-latest
4756 env :
4857 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments