In one of my repositories, I'm using GitHub actions to compare a fresh build with the one checked in into the repository. This is done like this:

- name: Compare the expected and actual dist/ directories
  run: |
    if [ "$(git diff --ignore-space-at-eol --ignore-cr-at-eol dist/ | wc -l)" -gt "0" ]; then
      echo "Detected uncommitted changes after build.  See status below:"
      git diff
      exit 1
    fi
  id: diff

Since this morning, I was getting the following error:

warning: in the working copy of 'dist/index.js', CRLF will be replaced by LF the next time Git touches it
Detected uncommitted changes after build.  See status below:
warning: in the working copy of 'dist/index.js', CRLF will be replaced by LF the next time Git touches it
diff --git a/dist/index.js b/dist/index.js
index 8018be6..31f317c 100644
Binary files a/dist/index.js and b/dist/index.js differ
Error: Process completed with exit code 1.

To fix it, it took two steps.

First, I updated the .gitattributes file and changed the following line:

* text=auto

was changed into:

* text=auto eol=lf

Then, I updated the step in the action to perform a renormalize of the line endings before doing the diff:

- name: Compare the expected and actual dist/ directories
  run: |
    git add --renormalize .
    if [ "$(git diff --ignore-space-at-eol --ignore-cr-at-eol dist/ | wc -l)" -gt "0" ]; then
      echo "Detected uncommitted changes after build.  See status below:"
      git diff
      exit 1
    fi
  id: diff