foxygoat / git-scripts

0 stars 1 forks source link

git-pr-merge: Move PR body trailers to end of merge commit #36

Closed camh- closed 10 months ago

camh- commented 10 months ago

Move any trailers at the end of a PRs message body to the end of the merge commit message so that the PR trailers appear in the correct spot in the merge commit message, after the merge summary (log, diffstat).

We still add a Pull-request: trailer (note that the capital "R" in request has been changed to lower case to conform to trailer conventions), and that is bundled with any PR trailers.

github-actions[bot] commented 10 months ago

sh-checker report

To get the full details, please check in the job output.

shellcheck errors ``` 'shellcheck ' returned error 1 finding the following syntactical issues: ---------- In git-pr-merge line 475: body="${body%%*(${nl})}" # strip trailing newlines. requires `shopt -s extglob` ^---^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: body="${body%%*("${nl}")}" # strip trailing newlines. requires `shopt -s extglob` In git-pr-merge line 477: body="${body%%*(${nl})${trailers}}" # strip trailers and preceding newlines ^---^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. ^---------^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: body="${body%%*("${nl}")"${trailers}"}" # strip trailers and preceding newlines For more information: https://www.shellcheck.net/wiki/SC2295 -- Expansions inside ${..} need to b... ---------- You can address the above issues in one of three ways: 1. Manually correct the issue in the offending shell script; 2. Disable specific issues by adding the comment: # shellcheck disable=NNNN above the line that contains the issue, where NNNN is the error code; 3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file. ```
shfmt errors ``` 'shfmt ' returned error 1 finding the following formatting issues: ---------- --- git-pr-merge.orig +++ git-pr-merge @@ -472,7 +472,7 @@ title="$(gh pr view --json title --jq .title "${pr_ref}")" body=$(gh pr view --json body --jq .body "${pr_ref}" | tr -d '\015') body=$(awk "${markdown_for_commit_awk}" <<<"${body}") # clean up markdown for readability - body="${body%%*(${nl})}" # strip trailing newlines. requires `shopt -s extglob` + body="${body%%*(${nl})}" # strip trailing newlines. requires `shopt -s extglob` trailers=$(git interpret-trailers --parse <<<"${body}") body="${body%%*(${nl})${trailers}}" # strip trailers and preceding newlines ---------- You can reformat the above files to meet shfmt's requirements by typing: shfmt -w filename ```
github-actions[bot] commented 10 months ago

sh-checker report

To get the full details, please check in the job output.

shellcheck errors ``` 'shellcheck ' returned error 1 finding the following syntactical issues: ---------- In git-pr-merge line 475: body="${body%%*(${nl})}" # strip trailing newlines. requires `shopt -s extglob` ^---^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: body="${body%%*("${nl}")}" # strip trailing newlines. requires `shopt -s extglob` In git-pr-merge line 477: body="${body%%*(${nl})${trailers}}" # strip trailers and preceding newlines ^---^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. ^---------^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: body="${body%%*("${nl}")"${trailers}"}" # strip trailers and preceding newlines For more information: https://www.shellcheck.net/wiki/SC2295 -- Expansions inside ${..} need to b... ---------- You can address the above issues in one of three ways: 1. Manually correct the issue in the offending shell script; 2. Disable specific issues by adding the comment: # shellcheck disable=NNNN above the line that contains the issue, where NNNN is the error code; 3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file. ```
shfmt errors ``` 'shfmt ' found no issues. ```
github-actions[bot] commented 10 months ago

sh-checker report

To get the full details, please check in the job output.

shellcheck errors ``` 'shellcheck ' found no issues. ```
shfmt errors ``` 'shfmt ' returned error 1 finding the following formatting issues: ---------- --- git-pr-merge.orig +++ git-pr-merge @@ -470,7 +470,7 @@ title="$(gh pr view --json title --jq .title "${pr_ref}")" body=$(gh pr view --json body --jq .body "${pr_ref}" | tr -d '\015') body=$(awk "${markdown_for_commit_awk}" <<<"${body}") # clean up markdown for readability - body="${body%%*($'\n')}" # strip trailing newlines. + body="${body%%*($'\n')}" # strip trailing newlines. trailers=$(git interpret-trailers --parse <<<"${body}") body="${body%%*($'\n')"${trailers}"}" # strip trailers and preceding newlines ---------- You can reformat the above files to meet shfmt's requirements by typing: shfmt -w filename ```