Skip to content

Commit 5387c73

Browse files
workflow: update build necessity checks for container images
Signed-off-by: Simon Beaudoin <[email protected]>
1 parent a60c4d9 commit 5387c73

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/qcom-container-build-and-upload.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Check if build is needed
4949
id: set-output
5050
run: |
51-
echo "build-needed=true" >> $GITHUB_OUTPUT
51+
echo "build-needed=false" >> $GITHUB_OUTPUT
5252
5353
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
5454
CHANGED_FILES=$(git diff --name-only origin/main...HEAD)
@@ -60,6 +60,23 @@ jobs:
6060
echo "Build is NOT needed as docker/ folder did not change."
6161
echo "build-needed=false" >> $GITHUB_OUTPUT
6262
fi
63+
64+
elif [[ "${{ github.event_name }}" == "push" ]]; then
65+
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }}..${{ github.event.after }})
66+
echo "Changed files: $CHANGED_FILES"
67+
if [[ $CHANGED_FILES == *".github/docker/"* ]]; then
68+
echo "Build IS needed as .github/docker/ folder changed."
69+
echo "build-needed=true" >> $GITHUB_OUTPUT
70+
else
71+
echo "Build is NOT needed as .github/docker/ folder did not change."
72+
echo "build-needed=false" >> $GITHUB_OUTPUT
73+
fi
74+
elif [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
75+
echo "Build is needed for schedule or workflow_dispatch or schedule."
76+
echo "build-needed=true" >> $GITHUB_OUTPUT
77+
else
78+
echo "Unrecognized event: ${{ github.event_name }}. Failing the build."
79+
exit 1
6380
fi
6481
6582
# Build the amd64 natively on ubuntu-latest which is an x86_64 host

0 commit comments

Comments
 (0)