[CI] Do not run black when no files changed (#14172)
Black expects at least one file or dir to format, so we need to handle
the case when no python files were modified.
Issue: https://github.com/openxla/iree/issues/14135
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 91f58d5..e1b3835 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -65,7 +65,7 @@
- name: Check if modified files are formatted
run: |
git diff "${GITHUB_BASE_REF?}" --name-only -- '*.py' ':!third_party' \
- | xargs black --check --diff --verbose
+ | xargs --no-run-if-empty black --check --diff --verbose
- name: Instructions for fixing the above linting errors
if: failure()
run: |