Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix text escaping for multiline with "`" commit messages #3406

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

blacha
Copy link
Member

@blacha blacha commented Feb 19, 2025

Motivation

There is a bug causing container builds to fail if the commit message contains a backtick "`"

When github replaces the commit message it directly inserts it into the script without any escaping

const x = ${{ github....commit_message }}

// directly replaced no quotes included, and includes \n as line breaks
const x = build: fix text.
body text here
some `comments` in the body

using toJson()

const x  = ${{ toJson(...commit_message) }}

// all escaped and includes a starting "
const x = "build: fix text.\nbody text here\nsome `comments` in the body"

using toJson and backticks

const x  = `${{ toJson(...commit_message) }}`

// Broken string
const x = `"build: fix text.\nbody text here\nsome `comments` in the body"`
//        ^                                        ^

Modifications

Removing "`" as toJson() will handle the string escaping.

Verification

Building containers as part of pull request.

@blacha blacha marked this pull request as ready for review February 19, 2025 23:05
@blacha blacha requested a review from a team as a code owner February 19, 2025 23:05
@blacha blacha added this pull request to the merge queue Feb 20, 2025
Merged via the queue into master with commit 5e25afa Feb 20, 2025
19 checks passed
@blacha blacha deleted the fix/multi-line-commit-message branch February 20, 2025 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants