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

Double Quotes in `pr_body` break string

Open jakobo opened this issue 4 years ago • 6 comments

    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - uses: repo-sync/pull-request@v2
        with:
          github_token: ${{ secrets.PAT }}
          pr_title: "⤴️ ${{ github.actor }} Draft Merge Request"
          pr_body: |
            :arrow_heading_up: Closes: #issueid <!-- your issue -->

            **Describe the Change** <!-- A longer description  -->
            "Put a description here"
          pr_draft: true

Expected: PR body is complete Actual: PR body cuts off at Put, without the quotation marks

I think the cause for this is the arg building for hub which doesn't have any double quote protection. Unfortunately, there's not much that can be done. Either the pr_body allows ${{ expressions }}, or it has to require " to be escaped. The current behavior requires " to be escaped, at which point we may just want to update the readme.

jakobo avatar Apr 28 '20 02:04 jakobo

This might be the way to go. PR welcome if anyone has time!

Excerpt When expanding a variable via `${variable@Q}`:

The expansion is a string that is the value of parameter quoted in a format that can be reused as input.

Example:

$ expand-q() { for i; do echo ${i@Q}; done; }  # Same as for `i in "$@"`...
$ expand-q word "two words" 'new
> line' "single'quote" 'double"quote'
word
'two words'
$'new\nline'
'single'\''quote'
'double"quote'

wei avatar Jun 26 '20 17:06 wei

Facing the same issue

manzoorwanijk avatar May 07 '21 08:05 manzoorwanijk

I'd like to add that inline code blocks (single backticks) seem to get removed from the PR body as well

xaviergmail avatar Jun 02 '21 15:06 xaviergmail

@xaviergmail I'm seeing the same thing. You also can't have a multiline PR body.

clayellis-cricut avatar Jun 03 '21 23:06 clayellis-cricut

Thanks for your inputs 😃

PR welcome if any of you have time. Potential solution is in my last comment~

wei avatar Jun 03 '21 23:06 wei

I am not 100% sure, but I believe there may be an issue with double quotes in a pr_template as well.

https://github.com/RetroArcher/.github/runs/7258096096?check_suite_focus=true#step:4:47

Oddly, the PR was created, but the step still failed.

ReenigneArcher avatar Jul 08 '22 21:07 ReenigneArcher

It seems to be working if \n is used with multiline string e.g.: https://github.com/Telefonica/mistica-icons/blob/8ece560530b0277eb0bd41aaddfc507d9ddf3dae/.github/workflows/figma-export.yml#L284-L286

Example PR: https://github.com/Telefonica/mistica-icons/pull/233

wei avatar Nov 01 '22 14:11 wei