Skip to content

Commit

Permalink
Small documentation improvements (#504)
Browse files Browse the repository at this point in the history
* Documentation: Fix typos

* Docs: Use main branch links to source code

The main branch evolves, and the documentation should evolve with it.
Link to TypeScript interfaces and code samples on the main branch to
avoid confusing users with outdated information.

The documentation can still go out-of-date, of course. Mitigate that a
bit by avoiding to link exact line numbers within a file, since they are
most likely to change.

* Docs: Improve consistency in prTitle documentation
  • Loading branch information
imphil authored Sep 8, 2024
1 parent c824547 commit d39f0b2
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions docs/config-file-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -340,27 +340,35 @@ 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
{
"prTitle": "{{commitMessages}} backport for {{targetBranch}}"
}
```

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`

Expand All @@ -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**

Expand All @@ -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`

Expand All @@ -409,7 +417,7 @@ Default: `False`

```json
{
"publishStatusCommentOnSuccess": false
"publishStatusCommentOnAbort": false
}
```

Expand Down Expand Up @@ -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-<hash>` or `pr-<pr number>` respectively.

Default: `backport/{{targetBranch}}/{{refValues}}`
Expand All @@ -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).

0 comments on commit d39f0b2

Please sign in to comment.