From 361cee24f7dd9be081cd5561ab742eb19cb890ac 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 (#2417) (#2421) --- .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 758af83dfd..c5a7762c3a 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 \