Commit 5e3bbc4ac4e for nodejs

commit 5e3bbc4ac4e4f24c41a892948046dbe8de4c2369
Author: Antoine du Hamel <duhamelantoine1995@gmail.com>
Date:   Thu Oct 1 00:38:19 2026 +0200

    tools: fix Nix diff tools when pushing more than 1 commit

    Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/66383
    Reviewed-By: Filip Skokan <panva.ip@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>

diff --git a/.github/workflows/nix-changes.yml b/.github/workflows/nix-changes.yml
index 8aeaf2c0e4e..c80e9e53f54 100644
--- a/.github/workflows/nix-changes.yml
+++ b/.github/workflows/nix-changes.yml
@@ -68,10 +68,16 @@ jobs:

       - name: Compute requisites before change
         run: |
-          git reset HEAD^ --hard
-          # TODO(aduh95): remove this once list-requisites.sh has reached `main`
-          [ -f tools/nix/list-requisites.sh ] || git checkout FETCH_HEAD -- tools/nix/list-requisites.sh
+          BASE_SHA="$(git rev-parse HEAD^)"
+          if [ -n "$PUSH_BEFORE_SHA" ] && [ "$PUSH_BEFORE_SHA" != "$BASE_SHA" ] \
+            && [ "$PUSH_BEFORE_SHA" != "0000000000000000000000000000000000000000" ] \
+            && git fetch --no-tags --depth=1 origin "$PUSH_BEFORE_SHA"; then
+            BASE_SHA="$PUSH_BEFORE_SHA"
+          fi
+          git reset "$BASE_SHA" --hard
           ./tools/nix/list-requisites.sh > requisites-${{ matrix.system }}-before.list
+        env:
+          PUSH_BEFORE_SHA: ${{ github.event_name == 'push' && github.event.before || '' }}

       - name: Output diff
         run: |