diff --git a/.github/workflows/todos-check.yml b/.github/workflows/todos-check.yml index 7db287212ae2..3e84254c9c95 100644 --- a/.github/workflows/todos-check.yml +++ b/.github/workflows/todos-check.yml @@ -25,14 +25,11 @@ jobs: # Fetch the target branch git fetch origin $GITHUB_BASE_REF - # Check if there is a common ancestor - if git merge-base --is-ancestor origin/$GITHUB_BASE_REF HEAD; then - # Get the diff of the changes - DIFF=$(git diff origin/$GITHUB_BASE_REF...HEAD) - else - # If no common ancestor, compare with the initial commit - DIFF=$(git diff $(git hash-object -t tree /dev/null) HEAD) - fi + git switch -c check_branch + + # Get the diff of the changes + DIFF=$(git diff origin/$GITHUB_BASE_REF check_branch) + # Check the diff for TODOs if echo "$DIFF" | grep -Eq '^\+.*(TODO|FIXME)'; then