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

Fix: Expansion of pr_body with breaking characters

Open math-breault opened this issue 3 years ago • 1 comments

Issue: #27

The expansion of the pr_body parameter from the INPUT_PR_BODY variable was not being properly escaped for use as an argument with hub. This caused " characters to end the command and the next character to be interpreted by bash, resulting in failures. This was also causing code blocks to disappear from the PR body.

The fix is the one suggested by @wei in https://github.com/repo-sync/pull-request/issues/27#issuecomment-650314540 . It uses the Q operator for expanding the INPUT_PR_BODY variable. Details on the expansion operator can be found here: https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html.

math-breault avatar May 16 '22 21:05 math-breault

this would not fix multiline body issues.

image

branch i used: https://github.com/dcflw/pull-request/commits/master

krtschmr avatar Sep 30 '22 06:09 krtschmr

@math-breault do you have capacity to take a look?

wei avatar Oct 31 '22 21:10 wei

Seems to be working with \n in #83 #103. Closing for now.

wei avatar Nov 01 '22 15:11 wei

not fixed for us. using \n inside the string.

code we use to generate the string (via ruby) image

image

pipeline code


  - uses: ruby/setup-ruby@v1
        name: Set up Ruby 2.7.5
        with:
          ruby-version: 2.7.5
      - name: write message
        run: |
          ruby ./scripts/git_diff_message.rb
      - name: Get message
        id: vars
        run: echo ::set-output name=pr_body::$(cat pr_msg)

      - uses: repo-sync/pull-request@v2
        name: pull-request
        with:
          source_branch: ${{ steps.branch.outputs.name }}
          destination_branch: "master"
          pr_title: "🚢 ${{ steps.branch.outputs.name }} - SHIP IT :shipit:"
          pr_body: "
            ${{ steps.vars.outputs.pr_body }}"
          github_token: ${{ secrets.GITHUB_TOKEN }}

so to me this is clearly not fixed.

krtschmr avatar Nov 02 '22 21:11 krtschmr

@wei let's reopen this, unless i did something wrong :-)

krtschmr avatar Nov 02 '22 21:11 krtschmr