Fix an issue that the prevent-deletion.yaml workflow mistakenly detects image deletions when images are added or removed in the PR's base branch. The root cause of this issue is that the workflow directly compares the latest commit of the PR base branch with the latest commit of the PR.
This PR improves the accuracy of the image deletion detection script by adding the --merge-base option to the git diff command. This change ensures that git calculates the changes from the shared starting point of the HEAD and the PR head SHA.
Which TiDB Operator version(s) do your changes apply to? (Required)
Needs approval from an approver in each of these files:
- ~~[OWNERS](https://github.com/pingcap/docs-tidb-operator/blob/release-1.4/OWNERS)~~ [Oreoxmt]
Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
This is an automated cherry-pick of #2417
First-time contributors' checklist
What is changed, added, or deleted? (Required)
Fix an issue that the
prevent-deletion.yaml
workflow mistakenly detects image deletions when images are added or removed in the PR's base branch. The root cause of this issue is that the workflow directly compares the latest commit of the PR base branch with the latest commit of the PR.This PR improves the accuracy of the image deletion detection script by adding the
--merge-base
option to thegit diff
command. This change ensures that git calculates the changes from the shared starting point of the HEAD and the PR head SHA.Which TiDB Operator version(s) do your changes apply to? (Required)
What is the related PR or file link(s)?