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