devops-infra / action-pull-request

GitHub Action that will create a pull request from the current branch
https://christophshyper.github.io/
MIT License
74 stars 21 forks source link

Weird characters in the pull request created by the action #107

Closed hjpotter92 closed 2 years ago

hjpotter92 commented 2 years ago

:memo: Brief description

Recent PRs that have been created by this bot always seem to have some weird symbols appearing in them. An example of most recent such PR can be seen here: https://github.com/livepeer/catalyst/pull/247

as you see, the description of the PR is:

https://github.com/livepeer/catalyst/commit/6941d0f019dc61e3b7291f96a3f708a6ce16dbbd - livepeer-docker - 2022-11-07 12:40:15 ^NowALiNiA^ [AUTO-COMMIT] Update manifest.yaml^NowALiNiA^ Files changed:^NowALiNiA^M manifest.yaml

where i've no clue about the text ^NowALiNiA^ appearing in it. The workflow file is available at: https://github.com/livepeer/catalyst/blob/main/.github/workflows/staging.yaml

:warning: Checklist

lexuzieel commented 2 years ago

Same issue for me

lexuzieel commented 2 years ago

Alright, after looking a bit into the source code I found a way to override output by setting body to " " (note the space), since bash considers that as not an empty string (reference: https://github.com/devops-infra/action-pull-request/blob/master/entrypoint.sh#L103)

I looks like ^NowALiNiA^ is a temporary sequence that doesn't get replaced properly for some reason (judging by this segment)

ChristophShyper commented 2 years ago

Hello, I'll have a look at it soon. NowALiNiA means new line in Polish. It's meant to be a string that you would never have in your PR :) It's explained here https://github.com/devops-infra/action-pull-request/blob/master/entrypoint.sh#L79-L81

ChristophShyper commented 2 years ago

I've identified one bug in my code. I haven't used that condition and was not aware it broke after upgrading to Ubuntu from Alpine.

It was in https://github.com/devops-infra/action-commit-push a

image

New version shows the commit message properly image

But PR body still has those special tags instead of newline. Looking further.

ChristophShyper commented 2 years ago

Ok, the second problem was with sed gobbling here https://github.com/devops-infra/action-pull-request/pull/109/files#diff-6f9d41d046756f0ddc2fcee0626bdb50100d12b88f293734eff742818e03efa2R132

Now all is tested and fixed.

Please upgrade your workflows to: devops-infra/action-commit-push@v0.9.2 devops-infra/action-pull-request@v0.5.3

hjpotter92 commented 2 years ago

This is fixed with new changes.

Thanks :)