Skip to content

Commit 8bcab63

Browse files
committed
fixing bash logic in set-dirs
Signed-off-by: Peter St. John <pstjohn@nvidia.com>
1 parent 5e71f32 commit 8bcab63

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

.github/workflows/unit-tests-recipes.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,26 @@ jobs:
5555
# Determine which directories to run: all for schedule, filtered for other events
5656
if [[ "${{ github.event_name }}" == "schedule" ]]; then
5757
DIRS="$ALL_DIRS"
58-
elif [[ '${{ steps.get-pr-info.outputs.pr-info }}' != 'null' ]] && echo '${{ steps.get-pr-info.outputs.pr-info }}' | jq -e '.labels[]? | select(.name == "INCLUDE_ALL_RECIPES")' > /dev/null 2>&1; then
59-
echo "Found INCLUDE_ALL_RECIPES label - running all directories"
60-
DIRS="$ALL_DIRS"
6158
else
62-
CHANGED_FILES='${{ steps.changed-files.outputs.all_changed_files }}'
63-
# Filter directories to only those that have changed files
64-
DIRS=$(echo "$ALL_DIRS" | jq -c --argjson changed "$CHANGED_FILES" '
65-
map(select(. as $dir | $changed | index($dir) != null))
66-
')
59+
# Check if INCLUDE_ALL_RECIPES label is present
60+
PR_INFO='${{ steps.get-pr-info.outputs.pr-info }}'
61+
HAS_INCLUDE_ALL_LABEL=false
62+
if [[ "$PR_INFO" != "null" && "$PR_INFO" != "" ]]; then
63+
if echo "$PR_INFO" | jq -e '.labels[]? | select(.name == "INCLUDE_ALL_RECIPES")' > /dev/null 2>&1; then
64+
HAS_INCLUDE_ALL_LABEL=true
65+
echo "Found INCLUDE_ALL_RECIPES label - running all directories"
66+
fi
67+
fi
68+
69+
if [[ "$HAS_INCLUDE_ALL_LABEL" == "true" ]]; then
70+
DIRS="$ALL_DIRS"
71+
else
72+
CHANGED_FILES='${{ steps.changed-files.outputs.all_changed_files }}'
73+
# Filter directories to only those that have changed files
74+
DIRS=$(echo "$ALL_DIRS" | jq -c --argjson changed "$CHANGED_FILES" '
75+
map(select(. as $dir | $changed | index($dir) != null))
76+
')
77+
fi
6778
fi
6879
6980
# Assign Docker images to the selected directories

0 commit comments

Comments
 (0)