diff --git a/docs/config-file-options.md b/docs/config-file-options.md index b1b9ad12..fc560e34 100644 --- a/docs/config-file-options.md +++ b/docs/config-file-options.md @@ -193,7 +193,7 @@ Default: `backport` #### `branchLabelMapping` -Automatically detech which branches a pull request should be backported to, based on the pull request labels. +Automatically detect which branches a pull request should be backported to, based on the pull request labels. ```json { @@ -340,19 +340,19 @@ Template values: - `{{sourceBranch}}`: Branch the commit is coming from (usually `main`) - `{{targetBranch}}`: Branch the backport PR will be targeting -- `{{sourcePullRequest}}`: Original pull request object (see [interface](https://github.com/sorenlouv/backport/blob/9e42503a7d0e06e60c575ed2c3b7dc3e5df0dd5c/src/lib/sourceCommit/parseSourceCommit.ts#L23-L31)) +- `{{sourcePullRequest}}`: Original pull request object (see [`Commit` interface](https://github.com/sorenlouv/backport/blob/main/src/lib/sourceCommit/parseSourceCommit.ts)) - `{{commitMessages}}`: Message of backported commit. For multiple commits the messages will be separated by pipes (`|`). -- `{{commits}}`: A list of commits ([interface](https://github.com/sorenlouv/backport/blob/9e42503a7d0e06e60c575ed2c3b7dc3e5df0dd5c/src/lib/sourceCommit/parseSourceCommit.ts#L15-L36)) +- `{{commits}}`: A list of commits ([`Commit` interface](https://github.com/sorenlouv/backport/blob/main/src/lib/sourceCommit/parseSourceCommit.ts)) -Default: `"[{{targetBranch}}] {{commitMessages}}"` +**Default** -**Example: Use original PR title prefixed by branch** - -``` -{{targetBranch}} {{sourcePullRequest.title}} +```json +{ + "prTitle": "[{{targetBranch}}] {{commitMessages}}" +} ``` -**Example** +**Example: Slightly more verbose** ```json { @@ -360,7 +360,15 @@ Default: `"[{{targetBranch}}] {{commitMessages}}"` } ``` -See [source code](https://github.com/sorenlouv/backport/blob/7c998dd05bda06e9979409cc4e63273bad711d11/src/lib/github/v3/createPullRequest.test.ts#L340-L522) for more examples +**Example: Use original PR title prefixed by branch** + +```json +{ + "prTitle": "{{targetBranch}} {{sourcePullRequest.title}}" +} +``` + +See [source code](https://github.com/sorenlouv/backport/blob/main/src/lib/github/v3/createPullRequest.test.ts) for more examples. #### `prDescription` @@ -371,7 +379,7 @@ The description uses the [handlebars templating engine](https://handlebarsjs.com - `{{targetBranch}}`: Branch the backport PR will be targeting - `{{commitMessages}}`: Message of backported commit. For multiple commits the messages will be separated by new lines (`|`). - `{{defaultPrDescription}}`: The default PR description. Using this makes it easy to append and prepend text to the existing description -- `{{commits}}`: A list of commit objects (see [commit interface](https://github.com/sorenlouv/backport/blob/9e42503a7d0e06e60c575ed2c3b7dc3e5df0dd5c/src/lib/sourceCommit/parseSourceCommit.ts#L15-L36)) +- `{{commits}}`: A list of commit objects (see [`Commit` interface](https://github.com/sorenlouv/backport/blob/main/src/lib/sourceCommit/parseSourceCommit.ts)) **Example: List commits** @@ -389,7 +397,7 @@ For people who often want to append the same text, they can create a bash alias: alias backport-skip-ci='backport --pr-description "{defaultPrDescription} [skip-ci]"' ``` -See [source code](https://github.com/sorenlouv/backport/blob/7c998dd05bda06e9979409cc4e63273bad711d11/src/lib/github/v3/createPullRequest.test.ts#L340-L522) for more examples +See [source code](https://github.com/sorenlouv/backport/blob/main/src/lib/github/v3/createPullRequest.test.ts) for more examples. #### `prFilter` @@ -525,7 +533,7 @@ Branch name to use for the backport PR Template values: - `{{targetBranch}}`: Branch the backport PR will be targeting -- `{{sourcePullRequest}}`: Original pull request object (see [interface](https://github.com/sorenlouv/backport/blob/9e42503a7d0e06e60c575ed2c3b7dc3e5df0dd5c/src/lib/sourceCommit/parseSourceCommit.ts#L23-L31)) +- `{{sourcePullRequest}}`: Original pull request object (see [`Commit` interface](https://github.com/sorenlouv/backport/blob/main/src/lib/sourceCommit/parseSourceCommit.ts)) - `{{refValues}}`: Name representing the original commit/PR, `commit-` or `pr-` respectively. Default: `backport/{{targetBranch}}/{{refValues}}` @@ -538,4 +546,4 @@ Default: `backport/{{targetBranch}}/{{refValues}}` } ``` -See [source code](https://github.com/sorenlouv/backport/blob/main/src/lib/cherrypickAndCreateTargetPullRequest/getBackportBranchName.ts#L14). +See [source code](https://github.com/sorenlouv/backport/blob/main/src/lib/cherrypickAndCreateTargetPullRequest/getBackportBranchName.ts). diff --git a/src/lib/child-process-promisified.ts b/src/lib/child-process-promisified.ts index b60a4dd8..400fee1c 100644 --- a/src/lib/child-process-promisified.ts +++ b/src/lib/child-process-promisified.ts @@ -46,8 +46,8 @@ export async function spawnPromise( const subprocess = childProcess.spawn(cmd, cmdArgs, { cwd, - // ensure that git commands return english error messages - env: { ...process.env, LANG: 'en_US' }, + // ensure that git commands return English error messages + env: { ...process.env, LANG: 'C' }, ...(isInteractive ? { stdio: 'inherit' } : undefined), }); let stderr = ''; @@ -95,7 +95,7 @@ export const spawnStream = (cmd: string, cmdArgs: ReadonlyArray) => { const spawnSpan = startSpawnSpan(cmd, cmdArgs); const res = childProcess.spawn(cmd, cmdArgs, { - env: { ...process.env, LANG: 'en_US' }, + env: { ...process.env, LANG: 'C' }, }); res.on('close', (code) => { diff --git a/src/test/e2e/cli/copy-reviewers-to-target-pull-request.private.test.ts b/src/test/e2e/cli/copy-reviewers-to-target-pull-request.private.test.ts index f49be96f..351c3afd 100644 --- a/src/test/e2e/cli/copy-reviewers-to-target-pull-request.private.test.ts +++ b/src/test/e2e/cli/copy-reviewers-to-target-pull-request.private.test.ts @@ -6,7 +6,7 @@ import { runBackportViaCli } from './runBackportViaCli'; const accessToken = getDevAccessToken(); const octokit = new Octokit({ auth: accessToken }); -jest.setTimeout(15_000); +jest.setTimeout(25_000); describe('backport-org/repo-with-reviewed-pull-requests', () => { let pullRequest: Awaited>;