Skip to content

Commit c6714d1

Browse files
fix update build environment triggering
1 parent d4d9123 commit c6714d1

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

.github/workflows/update_build_environment.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,20 @@ jobs:
1717
- name: Check if Dockerfile needs to be rebuilt
1818
id: check-stale
1919
run: |
20+
echo "Checking if Dockerfile was modified since last commit on this PR"
2021
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
2534
echo "PR synchronized, but Dockerfile was not edited. Not rebuilding the image."
2635
echo "stale_dockerfile=false" >> "$GITHUB_OUTPUT"
2736
else

0 commit comments

Comments
 (0)