From b5c56012d3e65eb61266a395d1df34de3f1a2996 Mon Sep 17 00:00:00 2001 From: Aolin Date: Mon, 17 Jul 2023 17:35:06 +0800 Subject: [PATCH] ci: add --merge-base option to git diff command in the prevent deletion workflow Signed-off-by: Aolin --- .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 \