Skip to content

Commit 9094f9c

Browse files
lcawlcotti
andauthored
[DOCS] Add changelog gh-release info (#2841)
Co-authored-by: Felipe Cotti <felipe.cotti@elastic.co>
1 parent 6bee5fc commit 9094f9c

File tree

4 files changed

+109
-1
lines changed

4 files changed

+109
-1
lines changed

docs/_docset.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ toc:
165165
- file: changelog-add.md
166166
- file: changelog-bundle.md
167167
- file: changelog-bundle-amend.md
168+
- file: changelog-gh-release.md
168169
- file: changelog-init.md
169170
- file: changelog-remove.md
170171
- file: changelog-render.md
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
navigation_title: "changelog gh-release"
3+
---
4+
5+
# changelog gh-release
6+
7+
Create changelog files and a bundle from a GitHub release by parsing pull request references in the release notes.
8+
9+
For details and examples, go to [](/contribute/changelog.md).
10+
11+
## Usage
12+
13+
```sh
14+
docs-builder changelog gh-release <repo> [version] [options...] [-h|--help]
15+
```
16+
17+
## Arguments
18+
19+
`repo`
20+
: Required: GitHub repository in `owner/repo` format (for example, `elastic/elasticsearch`) or just the repository name (for example, `elasticsearch`), which defaults to `elastic` as the owner.
21+
22+
`version`
23+
: Optional: The release tag to fetch (for example, `v9.2.0` or `9.2.0`). Defaults to `latest`.
24+
25+
## Options
26+
27+
`--config <string?>`
28+
: Optional: Path to the changelog.yml configuration file. Defaults to `docs/changelog.yml`.
29+
30+
`--output <string?>`
31+
: Optional: Output directory for the generated changelog files. Defaults to `./changelogs`.
32+
33+
`--strip-title-prefix`
34+
: Optional: Remove square brackets and the text within them from the beginning of pull request titles, and also remove a colon if it follows the closing bracket.
35+
: For example, `"[Inference API] New embedding model support"` becomes `"New embedding model support"`.
36+
: Multiple bracket prefixes are also supported (for example, `"[Discover][ESQL] Fix filtering"` becomes `"Fix filtering"`).
37+
38+
`--warn-on-type-mismatch`
39+
: Optional: Warn when the type inferred from Release Drafter section headers (for example, "Bug Fixes") doesn't match the type derived from the pull request's labels. Defaults to `true`.
40+
41+
## Output
42+
43+
The command creates two types of output in the directory specified by `--output`:
44+
45+
- One YAML changelog file per pull request found in the release notes.
46+
- A `changelog-bundle.yaml` file that references all created changelog files.
47+
48+
The product, target version, and lifecycle are inferred automatically from the release tag and the repository name (via [products.yml](https://github.com/elastic/docs-builder/blob/main/config/products.yml)). For example, a tag of `v9.2.0` on `elastic/elasticsearch` creates changelogs with `product: elasticsearch`, `target: 9.2.0`, and `lifecycle: ga`.
49+
50+
## Examples
51+
52+
### Create changelogs from the latest release
53+
54+
```sh
55+
docs-builder changelog gh-release elastic/elasticsearch
56+
```
57+
58+
### Create changelogs from a specific version tag
59+
60+
```sh
61+
docs-builder changelog gh-release elastic/elasticsearch v9.2.0
62+
```
63+
64+
### Use a short repository name
65+
66+
```sh
67+
docs-builder changelog gh-release elasticsearch v9.2.0
68+
```
69+
70+
### Specify a custom output directory
71+
72+
```sh
73+
docs-builder changelog gh-release elasticsearch v9.2.0 \
74+
--output ./docs/changelog \
75+
--config ./docs/changelog.yml
76+
```
77+
78+
### Strip component prefixes from titles
79+
80+
```sh
81+
docs-builder changelog gh-release elasticsearch v9.2.0 --strip-title-prefix
82+
```

docs/cli/release/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ These commands are associated with product release documentation.
88

99
- [changelog add](changelog-add.md) - Create a changelog file
1010
- [changelog bundle](changelog-bundle.md) - Create a changelog bundle file
11+
- [changelog gh-release](changelog-gh-release.md) - Create changelogs and a bundle from a GitHub release
1112
- [changelog init](changelog-init.md) - Initialize changelog configuration and folder structure
1213
- [changelog bundle-amend](changelog-bundle-amend.md) - Add entries to an existing bundle
1314
- [changelog render](changelog-render.md) - Generate markdown output from changelog bundle files

docs/contribute/changelog.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ To use the `docs-builder changelog` commands in your development workflow:
2424
1. Optional: Add labels to your GitHub pull requests to indicate that they are not notable and should not generate changelogs. For example, `non-issue` or `release_notes:skip`. Alternatively, you can assume that all PRs are *not* notable unless a specific label is present (for example, `@Public`).
2525
1. [Configure changelog settings](#changelog-settings) to correctly interpret your PR labels.
2626
1. [Create changelogs](#changelog-add) with the `docs-builder changelog add` command.
27+
- Alternatively, use the `docs-builder changelog gh-release` command as a one-shot alternative that creates changelog files and a bundle directly from a GitHub release. Refer to [Create changelogs from a GitHub release](#changelog-gh-release).
2728
1. [Create changelog bundles](#changelog-bundle) with the `docs-builder changelog bundle` command. For example, create a bundle for the pull requests that are included in a product release.
2829
1. [Create documentation](#render-changelogs) with the `docs-builder changelog render` command.
2930

@@ -480,6 +481,26 @@ docs-builder changelog add \
480481

481482
This creates one changelog file for each PR specified, whether from files or directly.
482483

484+
## Create changelogs from a GitHub release [changelog-gh-release]
485+
486+
If you use [Release Drafter](https://github.com/release-drafter/release-drafter) or a similar tool to generate GitHub release notes that reference pull requests, you can use the `docs-builder changelog gh-release` command as a one-shot alternative to `changelog add` + `changelog bundle`.
487+
The command parses the release notes, creates one changelog file per pull request found, and creates a `changelog-bundle.yaml` file — all in a single step.
488+
489+
For up-to-date command usage information, use the `-h` option or refer to [](/cli/release/changelog-gh-release.md).
490+
491+
```sh
492+
docs-builder changelog gh-release elasticsearch v9.2.0 \
493+
--output ./docs/changelog \
494+
--config ./docs/changelog.yml
495+
```
496+
497+
The product, target version, and lifecycle are inferred automatically from the release tag and the repository name.
498+
For example, a tag of `v9.2.0` on `elasticsearch` creates changelogs with `product: elasticsearch`, `target: 9.2.0`, and `lifecycle: ga`.
499+
500+
:::{note}
501+
This command requires a `GITHUB_TOKEN` or `GH_TOKEN` environment variable (or an active `gh` login) to fetch release details from the GitHub API. Refer to [Authorization](#authorization) for details.
502+
:::
503+
483504
## Create bundles [changelog-bundle]
484505

485506
You can use the `docs-builder changelog bundle` command to create a YAML file that lists multiple changelogs.
@@ -682,7 +703,10 @@ docs-builder changelog bundle --issues "12345,12346" \
682703

683704
### Filter by pull request file [changelog-bundle-file]
684705

685-
If you have a file that lists pull requests (such as PRs associated with a GitHub release):
706+
If you have a file that lists pull requests (such as PRs associated with a GitHub release), you can pass it to `--prs`.
707+
If your release uses Release Drafter-style notes, you can also let the tool fetch and parse the PR list directly with `docs-builder changelog gh-release`. Refer to [Create changelogs from a GitHub release](#changelog-gh-release).
708+
709+
If you have a file that lists pull requests:
686710

687711
```txt
688712
https://github.com/elastic/elasticsearch/pull/108875

0 commit comments

Comments
 (0)