@@ -2,8 +2,6 @@ name: Rebuild and publish new ubcdsci/intro-to-ds image on DockerHub
2
2
on :
3
3
pull_request :
4
4
types : [opened, synchronize]
5
- paths :
6
- - Dockerfile
7
5
jobs :
8
6
rebuild-docker :
9
7
name : Rebuild docker image
@@ -21,17 +19,12 @@ jobs:
21
19
run : |
22
20
echo "GitHub PR action type: ${{ github.event.action }}"
23
21
echo "Checking if the PR modifies the Dockerfile"
24
- if [[ ${{ github.event.action }} == 'opened' ]] ; then
25
- echo "PR just opened, and it edits the Dockerfile, so rebuilding the image."
26
- echo "stale_dockerfile=true " >> "$GITHUB_OUTPUT"
22
+ if git diff --quiet ${{ github.event.before }} ${{ github.event.after }} Dockerfile ; then
23
+ echo "PR synchronized/ opened, but Dockerfile was not edited. Not rebuilding the image."
24
+ echo "stale_dockerfile=false " >> "$GITHUB_OUTPUT"
27
25
else
28
- if git diff --quiet ${{ github.event.before }} ${{ github.event.after }} Dockerfile; then
29
- echo "PR synchronized, but Dockerfile was not edited. Not rebuilding the image."
30
- echo "stale_dockerfile=false" >> "$GITHUB_OUTPUT"
31
- else
32
- echo "PR synchronized, and Dockerfile was edited, so rebuilding the image."
33
- echo "stale_dockerfile=true" >> "$GITHUB_OUTPUT"
34
- fi
26
+ echo "PR synchronized/opened, and Dockerfile was edited, so rebuilding the image."
27
+ echo "stale_dockerfile=true" >> "$GITHUB_OUTPUT"
35
28
fi
36
29
- name : Rebuild and publish image
37
30
if : ${{ steps.check-stale.outputs.stale_dockerfile == 'true' }}
0 commit comments