From 385d636be39f109c94804478afe43e690d377dcf Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 1 May 2024 12:52:57 -0400 Subject: [PATCH] ci: Avoid suggesting unnecessary baseline updates (#37158) When checking for baselines that need updating due to fixed issues, we ignore the "issue statistics" comment at the top of the file so as to not make people have to update the baselines unnecessarily. However, if one project has a real update needed while a different one has only comments, we're still instructing the author to update both of them even though only the former is needed. Let's not do that. --- .github/workflows/tests.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2772beda960c6..bb685c3f4d8f0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -327,7 +327,7 @@ jobs: pnpm jetpack phan --all -v --format github - name: Check baselines run: | - # Anything changed (with a side of printing the diff) + # Anything changed? (with a side of printing the diff) if git diff --exit-code --ignore-matching-lines='^ // ' -- .phan/baseline.php '*/.phan/baseline.php'; then exit 0 fi @@ -335,6 +335,11 @@ jobs: # Collect which projects changed to suggest the right command. PROJECTS=() for f in $( git -c core.quotepath=off diff --name-only -- .phan/baseline.php '*/.phan/baseline.php' ); do + # --name-only and --ignore-matching-lines don't combine, so we have to do the check separately. + if git diff --quiet --exit-code --ignore-matching-lines='^ // ' -- "$f"; then + continue + fi + if [[ "$f" == ".phan/baseline.php" ]]; then SLUG=monorepo elif [[ "$f" == projects/*/*/.phan/baseline.php ]]; then