Skip to content

Commit

Permalink
ci: dont run actions on deleted files
Browse files Browse the repository at this point in the history
--diff-filter=ACM:
A: Added files.
C: Copied files (if applicable).
M: Modified files. This excludes deleted (D) files.
  • Loading branch information
danctorres committed Jan 5, 2025
1 parent bb25c04 commit d895668
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/arduino_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Find affected files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only origin/${{ github.base_ref }} > affected_files.txt
git diff --diff-filter=ACM --name-only origin/${{ github.base_ref }} > affected_files.txt
echo "Affected files:"
cat affected_files.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bazel_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
id: affected_files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only origin/${{ github.base_ref }} > affected_files.txt
git diff --diff-filter=ACM --name-only origin/${{ github.base_ref }} > affected_files.txt
echo "Affected files:"
cat affected_files.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bazel_buildifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Find affected files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only origin/${{ github.base_ref }} > affected_files.txt
git diff --diff-filter=ACM --name-only origin/${{ github.base_ref }} > affected_files.txt
echo "Affected files:"
cat affected_files.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bazel_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
id: affected_files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only origin/${{ github.base_ref }} > affected_files.txt
git diff --diff-filter=ACM --name-only origin/${{ github.base_ref }} > affected_files.txt
echo "Affected files:"
cat affected_files.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Find affected files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only origin/${{ github.base_ref }} > affected_files.txt
git diff --diff-filter=ACM --name-only origin/${{ github.base_ref }} > affected_files.txt
echo "Affected files:"
cat affected_files.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang_tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Find affected files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only origin/${{ github.base_ref }} > affected_files.txt
git diff --diff-filter=ACM --name-only origin/${{ github.base_ref }} > affected_files.txt
echo "Affected files:"
cat affected_files.txt
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
id: affected_files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only origin/${{ github.base_ref }} > affected_files.txt
git diff --diff-filter=ACM --name-only origin/${{ github.base_ref }} > affected_files.txt
echo "Affected files:"
cat affected_files.txt
Expand Down Expand Up @@ -56,13 +56,15 @@ jobs:
for target in $targets; do
result=$(bazelisk cquery "kind('cc_test', deps('$target'))") || exit 1
# Remove the part in parentheses (e.g., (f37096a))
formatted_result=$(echo "$result" | sed 's/ ([^)]*)//g')
if [[ -n "$result" ]]; then
# Remove the part in parentheses (e.g., (f37096a))
formatted_result=$(echo "$result" | sed 's/ ([^)]*)//g')
# Prefix each line of the result with a `-`
formatted_result=$(echo "$formatted_result" | sed 's/^/-/')
# Prefix each line of the result with a `-`
formatted_result=$(echo "$formatted_result" | sed 's/^/-/')
test_targets+="$formatted_result"$'\n'
test_targets+="$formatted_result"$'\n'
fi
done
echo "$test_targets" > test_targets.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Find affected files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only origin/${{ github.base_ref }} > affected_files.txt
git diff --diff-filter=ACM --name-only origin/${{ github.base_ref }} > affected_files.txt
echo "Affected files:"
cat affected_files.txt
Expand Down

0 comments on commit d895668

Please sign in to comment.