File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,20 @@ jobs:
17
17
- name : Check if Dockerfile needs to be rebuilt
18
18
id : check-stale
19
19
run : |
20
+ echo "Checking if Dockerfile was modified since last commit on this PR"
20
21
echo "GitHub PR action type: ${{ github.event.action }}"
21
- echo "Checking if the PR modifies the Dockerfile"
22
- echo "GitHub event before: ${{ github.event.before }}"
23
- echo "GitHub event after: ${{ github.event.after }}"
24
- if git diff --quiet ${{ github.event.before }} ${{ github.event.after }} Dockerfile; then
22
+ if [ "${{ github.event.action }}" == "opened" ]; then
23
+ echo "GitHub base ref: ${{ github.event.pull_request.base.sha }}"
24
+ echo "GitHub head ref: ${{ github.event.pull_request.head.sha }}"
25
+ BEFORE=${{ github.event.pull_request.base.sha }}
26
+ AFTER=${{ github.event.pull_request.head.sha }}
27
+ else
28
+ echo "GitHub event before: ${{ github.event.before }}"
29
+ echo "GitHub event after: ${{ github.event.after }}"
30
+ BEFORE=${{ github.event.before }}
31
+ AFTER=${{ github.event.after }}
32
+ fi
33
+ if git diff --quiet $BEFORE $AFTER Dockerfile; then
25
34
echo "PR synchronized, but Dockerfile was not edited. Not rebuilding the image."
26
35
echo "stale_dockerfile=false" >> "$GITHUB_OUTPUT"
27
36
else
You can’t perform that action at this time.
0 commit comments