Action fails when the file has just LF/CRLF diffs on windows
Subject of the issue
I use create-pull-request to create pr after build the bindings on different platforms. On windows, the built bindings uses CRLF, but when they are committed to repo, CRLF will be replaced by LF, results in "nothing to commit" error and the action fails then
Steps to reproduce
See this action run: https://github.com/HaoboGu/ors/runs/7482028978?check_suite_focus=true#step:7:67
Hi @HaoboGu
Is the problem that CRLF will be replaced by LF? Is that what you want to prevent? If so, it looks like you can disable that in git config. You could try disabling it in a step before the action runs. https://stackoverflow.com/a/17628353/11934042
@peter-evans I want CRLFs replaced by LF in my repo, so I don't want to disable that git config.
The problematic file is auto-generated on Windows so git recognizes it's different from the file in the repo. But due to the replacement config of git, there is nothing to commit, which leads to this error.
I expect that the action could just ignore this kind of error.
Same issue here: https://github.com/devlooped/sponsors/runs/7789936995?check_suite_focus=true.
This should totally be ignored by the action.
@HaoboGu @kzu I've made a fix for this issue here: https://github.com/peter-evans/create-pull-request/pull/1211
I had trouble trying to reproduce this behaviour in an integration test and eventually gave up. So it would be great if you could test this version of the action and let me know if it fixes the issue for you.
You can test the new version like this:
- uses: peter-evans/create-pull-request@win-crlf-fix
Verified.
action run: https://github.com/HaoboGu/ors/actions/runs/2880445434
@HaoboGu Thank you for testing! I will get this released.
Released as v4.1.1 / v4.
@HaoboGu Please let me know when you have reverted the version back to v4 so I can remove the win-crlf-fix testing branch.
@peter-evans everything goes well, thanks for the work!