create-pull-request icon indicating copy to clipboard operation
create-pull-request copied to clipboard

Action fails when the file has just LF/CRLF diffs on windows

Open HaoboGu opened this issue 3 years ago • 2 comments

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

HaoboGu avatar Jul 23 '22 16:07 HaoboGu

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 avatar Jul 29 '22 04:07 peter-evans

@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.

HaoboGu avatar Jul 29 '22 06:07 HaoboGu

Same issue here: https://github.com/devlooped/sponsors/runs/7789936995?check_suite_focus=true.

This should totally be ignored by the action.

kzu avatar Aug 11 '22 15:08 kzu

@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

peter-evans avatar Aug 17 '22 07:08 peter-evans

Verified.

action run: https://github.com/HaoboGu/ors/actions/runs/2880445434

HaoboGu avatar Aug 18 '22 06:08 HaoboGu

@HaoboGu Thank you for testing! I will get this released.

peter-evans avatar Aug 18 '22 08:08 peter-evans

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 avatar Aug 18 '22 08:08 peter-evans

@peter-evans everything goes well, thanks for the work!

HaoboGu avatar Aug 18 '22 10:08 HaoboGu