From 16079cc3ee56628623782a76249e45aa02b0874f Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Mon, 17 Jul 2023 19:15:46 +0800 Subject: [PATCH] ci: update the git diff command in the prevent deletion workflow to improve accuracy (#14232) (#14259) --- .github/workflows/prevent-deletion.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prevent-deletion.yaml b/.github/workflows/prevent-deletion.yaml index 76786ec54f6c4..62b6c32c9a506 100644 --- a/.github/workflows/prevent-deletion.yaml +++ b/.github/workflows/prevent-deletion.yaml @@ -23,7 +23,7 @@ jobs: - name: Find changes run: | git rev-parse '${{ github.event.pull_request.head.sha }}' - if git diff --name-only --diff-filter 'D' HEAD '${{ github.event.pull_request.head.sha }}' | grep -E '^media/.*\.(jpg|png|jpeg|gif)$' >/tmp/changed_files; then + if git diff --merge-base --name-only --diff-filter 'D' HEAD '${{ github.event.pull_request.head.sha }}' | grep -E '^media/.*\.(jpg|png|jpeg|gif)$' >/tmp/changed_files; then cat /tmp/changed_files echo '{"name":"Image Deletion Check","head_sha":"${{ github.event.pull_request.head.sha }}","status":"completed","conclusion":"failure"}' > /tmp/body.json jq \