Skip to content

Commit

Permalink
CI: Apply --diff-filter=d to all diff calls
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeJellinek committed Apr 4, 2024
1 parent 820b285 commit 3acc13a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .ci/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ get_translators_to_check() {
# when running from a local development PR branch
#
# The branching point hash retrieval logic is based on https://stackoverflow.com/a/12185115/3199106
#
# We get the set of modified files with git diff, passing --diff-filter=d to exclude deleted files.

TRANSLATORS_TO_CHECK=""

# Push to master
if [ "${GITHUB_REF:-}" = "refs/heads/master" ]; then
before_commit=$(jq -r '.before' $(echo $GITHUB_EVENT_PATH))
# --diff-filter=d: Exclude deleted files
TRANSLATORS_TO_CHECK=$(git diff $before_commit --name-only --diff-filter=d | { grep -e "^[^/]*.js$" || true; })
# Pull request
else
Expand All @@ -50,11 +51,11 @@ get_translators_to_check() {
if [ $num_parent_commits -gt 1 ]; then
first_parent=$(git rev-list --first-parent ^master HEAD^2 | tail -n1)
branch_point=$(git rev-list "$first_parent^^!")
TRANSLATORS_TO_CHECK=$(git diff HEAD^2 $branch_point --name-only | { grep -e "^[^/]*.js$" || true; })
TRANSLATORS_TO_CHECK=$(git diff HEAD^2 $branch_point --name-only --diff-filter=d | { grep -e "^[^/]*.js$" || true; })
else
first_parent=$(git rev-list --first-parent ^master HEAD | tail -n1)
branch_point=$(git rev-list "$first_parent^^!")
TRANSLATORS_TO_CHECK=$(git diff $branch_point --name-only | { grep -e "^[^/]*.js$" || true; })
TRANSLATORS_TO_CHECK=$(git diff $branch_point --name-only --diff-filter=d | { grep -e "^[^/]*.js$" || true; })
fi
fi
}

0 comments on commit 3acc13a

Please sign in to comment.