Skip to content

Commit a58f829

Browse files
committed
add test docker image to ghcr for dynamic VM testing
1 parent 6cf56b4 commit a58f829

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.github/workflows/build_test_containers.yml

+9-5
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,21 @@ jobs:
3434
- name: Get list of changed Dockerfiles
3535
id: get_changed_files
3636
run: |
37-
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep ansible/docker/test/Dockerfile)
38-
echo "changed_files=$changed_files" >> "$GITHUB_OUTPUT"
37+
if [ ${{ github.event_name }} == "push" ]; then
38+
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep ansible/docker/test/Dockerfile)
39+
else
40+
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep ansible/docker/test/Dockerfile)
41+
fi
42+
echo "changed_files=$changed_files" >> "$GITHUB_ENV"
3943
4044
# Generate matrix
4145
- name: Generate matrix
4246
id: generate_matrix
4347
run: |
44-
matrix=$(jq -n --arg files "$changed_files" '{
45-
include: ($files | split("\n") | map(select(length > 0) | {dockerfile: .}))
48+
matrix=$(jq -n --arg files "${changed_files}" '{
49+
"include": ($files | split("\n") | map(select(length > 0) | {dockerfile: .}))
4650
}')
47-
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
51+
echo "matrix<<EOF"$'\n'"$matrix"$'\n'EOF >> $GITHUB_OUTPUT
4852
4953
build-dockerfiles:
5054
name: Build Dockerfiles

0 commit comments

Comments
 (0)