From 29b7cca883126e76cf68fa2dfae91c1f0c0044d2 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Thu, 29 Jan 2026 14:13:43 +0100 Subject: [PATCH] [CI] Stabilise computing the list of changed files for ruff. When a user branched from master a while ago, the diff step in the ruff action can compute the list of changed files wrongly. Here, we use the fact that the checkout action uses a merge commit on top of the target branch, so computing the diff between the last two commits encompasses all the files touched in the PR. --- .github/workflows/code_analysis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code_analysis.yml b/.github/workflows/code_analysis.yml index 30abb91e96e71..caf0f89c3f0e2 100644 --- a/.github/workflows/code_analysis.yml +++ b/.github/workflows/code_analysis.yml @@ -54,12 +54,13 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 2 - name: Get the list of changed files id: diff run: | - git fetch --depth=1 origin $GITHUB_BASE_REF - git diff --diff-filter=AMR --name-only origin/$GITHUB_BASE_REF > changed_files.txt + git diff --diff-filter=AMR --name-only HEAD~1 | tee changed_files.txt - name: Install ruff uses: astral-sh/ruff-action@v3