Skip to content

Commit 437d5a1

Browse files
fix: prevent truncation of commit message and PR title (#717)
* fix: prevent truncation of commit message and PR title Co-Authored-By: Max Prilutskiy <maks.prilutskiy@gmail.com> * chore: add empty changeset Co-Authored-By: Max Prilutskiy <maks.prilutskiy@gmail.com> * chore: add proper changeset for commit message fix Co-Authored-By: Max Prilutskiy <maks.prilutskiy@gmail.com> * chore: remove empty changeset Co-Authored-By: Max Prilutskiy <maks.prilutskiy@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Max Prilutskiy <maks.prilutskiy@gmail.com>
1 parent 83439aa commit 437d5a1

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

.changeset/fix-commit-message.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"lingo.dev": patch
3+
---
4+
5+
fix: prevent truncation of commit message and PR title by properly escaping special characters in shell commands

packages/cli/src/cli/cmd/ci/flows/_base.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ export const gitConfig = {
2222
userName: "Lingo.dev",
2323
userEmail: "support@lingo.dev",
2424
};
25+
26+
export function escapeShellArg(arg: string): string {
27+
return `'${arg.replace(/'/g, "'\\''")}'`;
28+
}

packages/cli/src/cli/cmd/ci/flows/in-branch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { execSync } from "child_process";
22
import path from "path";
3-
import { gitConfig, IntegrationFlow } from "./_base";
3+
import { gitConfig, IntegrationFlow, escapeShellArg } from "./_base";
44
import i18nCmd from "../../i18n";
55

66
export class InBranchFlow extends IntegrationFlow {
@@ -28,7 +28,7 @@ export class InBranchFlow extends IntegrationFlow {
2828
execSync(`git add .`, { stdio: "inherit" });
2929
execSync(`git status --porcelain`, { stdio: "inherit" });
3030
execSync(
31-
`git commit -m "${this.platformKit.config.commitMessage}" --no-verify`,
31+
`git commit -m ${escapeShellArg(this.platformKit.config.commitMessage)} --no-verify`,
3232
{
3333
stdio: "inherit",
3434
},

0 commit comments

Comments
 (0)