From af62d0368f59cf8c5e0a6cb67d479069cd42ae64 Mon Sep 17 00:00:00 2001 From: David Peter Date: Tue, 22 Jul 2025 11:29:07 +0200 Subject: [PATCH] Run MD tests for Markdown-only changes (#19479) ## Summary Exclusions in Git pathspecs [are not order-sensitive](https://css-tricks.com/git-pathspecs-and-how-to-use-them/#aa-exclude): > After all other pathspecs have been resolved, all pathspecs with an exclude signature are resolved and then removed from the returned paths. This means that we can't write chains like we had here before to exclude Markdown file changes *unless* they are in `crates/ty_python_semantic/resources/mdtest`. This doesn't work. The exclude pattern will just overwrite the second pattern and all Markdown changes will be excluded: ```bash ':!**/*.md' \ ':crates/ty_python_semantic/resources/mdtest/**/*.md' \ ``` The configuration we had here before meant that tests wouldn't run on MD-test only PRs, see e.g. https://github.com/astral-sh/ruff/pull/19476. So here, I'm proposing to remove the broad `:!**/*.md` pattern. We can always add more fine-grained exclusion patterns, if that's needed. The `docs` folder is already excluded. ## Test Plan Tested with local `git diff` invocations. --- .github/workflows/ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 89023560a6..254334abfc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -143,12 +143,12 @@ jobs: env: MERGE_BASE: ${{ steps.merge_base.outputs.sha }} run: | - if git diff --quiet "${MERGE_BASE}...HEAD" -- ':**' \ - ':!**/*.md' \ - ':crates/ty_python_semantic/resources/mdtest/**/*.md' \ + # NOTE: Do not exclude all Markdown files here, but rather use + # specific exclude patterns like 'docs/**'), because tests for + # 'ty' are written in Markdown. + if git diff --quiet "${MERGE_BASE}...HEAD" -- \ ':!docs/**' \ ':!assets/**' \ - ':.github/workflows/ci.yaml' \ ; then echo "changed=false" >> "$GITHUB_OUTPUT" else