Skip to content

Commit 81079b2

Browse files
chore: Fixing check_skip_tests
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
1 parent 358b750 commit 81079b2

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

.github/workflows/check_skip_tests.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check for Changes
1+
name: Check if Tests should be Skipped
22

33
on:
44
workflow_call:
@@ -11,14 +11,14 @@ on:
1111
type: string
1212
excluded-dirs:
1313
required: false
14-
type: array
15-
default: ['docs/**', 'community/**', 'examples/**']
14+
type: string
15+
default: 'docs/**,community/**,examples/**'
1616

1717
jobs:
1818
check-changes:
1919
runs-on: ubuntu-latest
2020
outputs:
21-
skip_tests: ${{ steps.check_changes.outputs.skip_tests}}
21+
skip_tests: ${{ steps.check_changes.outputs.skip_tests }}
2222

2323
steps:
2424
- name: Checkout code
@@ -27,15 +27,25 @@ jobs:
2727
fetch-depth: 2
2828
ref: ${{ inputs.head-sha }}
2929

30+
- name: Set excluded dirs
31+
id: set_excluded_dirs
32+
run: |
33+
# If excluded-dirs is provided, split by commas and set them as an array
34+
EXCLUDED_DIRS="${{ inputs.excluded-dirs }}"
35+
IFS=',' read -r -a EXCLUDED_DIRS_ARRAY <<< "$EXCLUDED_DIRS"
36+
echo "Excluded directories: ${EXCLUDED_DIRS_ARRAY[@]}"
37+
echo "EXCLUDED_DIRS_ARRAY=${EXCLUDED_DIRS_ARRAY[@]}" >> $GITHUB_ENV
38+
3039
- name: Check for excluded directory changes
31-
id: check_changes
40+
id: check_skip_tests
3241
run: |
42+
# Check if any of the changed files are in the excluded directories
3343
CHANGED_FILES=$(git diff --name-only ${{ inputs.base-sha }} ${{ inputs.head-sha }})
3444
echo "Changed files:"
3545
echo "$CHANGED_FILES"
3646
37-
# Join the excluded directories into a single pattern
38-
EXCLUDE_PATTERN=$(IFS='|'; echo "${{ inputs.excluded-dirs[*] }}")
47+
# Build a regex pattern from the excluded directories
48+
EXCLUDE_PATTERN=$(IFS='|'; echo "${EXCLUDED_DIRS_ARRAY[*]}")
3949
4050
# Check if any changed file matches the exclusion patterns
4151
NON_EXCLUDED_CHANGED=$(echo "$CHANGED_FILES" | grep -Ev "^($EXCLUDE_PATTERN)" || true)

.github/workflows/unit_tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
with:
1010
base-sha: ${{ github.event.pull_request.base.sha }}
1111
head-sha: ${{ github.event.pull_request.head.sha }}
12-
excluded-dirs: ['docs/**', 'community/**', 'examples/**']
13-
id: check_changes
12+
excluded-dirs: 'docs/**,tests/**,examples/**'
13+
id: check_skip_tests
1414

1515
unit-test-python:
16-
if: ${{ steps.check_changes.outputs.skip-tests == 'false' }}
16+
if: ${{ steps.check_changes.outputs.skip_tests == 'false' }}
1717
runs-on: ${{ matrix.os }}
1818
strategy:
1919
fail-fast: false
@@ -51,7 +51,7 @@ jobs:
5151
run: uv cache prune --ci
5252

5353
unit-test-ui:
54-
if: ${{ steps.check_changes.outputs.skip-tests == 'false' }}
54+
if: ${{ steps.check_changes.outputs.skip_tests == 'false' }}
5555
runs-on: ubuntu-latest
5656
env:
5757
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)