Skip to content

Commit 458a1c7

Browse files
committed
fix: pr number input param for pi-matrix
1 parent 8307ba7 commit 458a1c7

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

.github/workflows/pi_matrix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ jobs:
4343
id: generate-matrix
4444
run: |
4545
bash cicd-deployment-scripts/pi/matrix.sh \
46-
-p "${{ github.event.pull_request.number }}" \
46+
-p "${{ github.event.pull_request.number || '' }}" \
4747
-s cicd-deployment-scripts/pi/settings.sh \
4848
-t "${{ inputs.parent_image_type }}"

pi/matrix.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,22 @@ done
1717

1818
source $SOURCE_SCRIPT
1919

20-
UPDATED_FILES=$(gh pr diff $PR_NUMBER --name-only)
2120
UPDATED_PARENT_TYPES=()
22-
while IFS= read -r file; do
23-
if [[ $file != requirements/* ]] || [[ $file != *.in ]]; then
24-
continue
25-
fi
26-
27-
parent_image_type=$(basename $file | sed 's|-requirements.in||g')
28-
UPDATED_PARENT_TYPES+=($parent_image_type)
2921

30-
done <<< "$UPDATED_FILES"
31-
32-
if [ -n $PARENT_IMAGE_TYPE ]; then
22+
if [ -n $PR_NUMBER ] && [ -z $PARENT_IMAGE_TYPE ]; then
23+
UPDATED_FILES=$(gh pr diff $PR_NUMBER --name-only)
24+
while IFS= read -r file; do
25+
if [[ $file != requirements/* ]] || [[ $file != *.in ]]; then
26+
continue
27+
fi
28+
29+
parent_image_type=$(basename $file | sed 's|-requirements.in||g')
30+
UPDATED_PARENT_TYPES+=($parent_image_type)
31+
32+
done <<< "$UPDATED_FILES"
33+
echo "::notice::Exporting matrix for parent image types: $UPDATED_PARENT_TYPES"
34+
elif [ -z $PR_NUMBER ] && [ -n $PARENT_IMAGE_TYPE ]; then
35+
echo "::notice::Exporting matrix for parent image type: $PARENT_IMAGE_TYPE"
3336
UPDATED_PARENT_TYPES=( $PARENT_IMAGE_TYPE )
3437
fi
3538

0 commit comments

Comments
 (0)