Skip to content

Commit 705bde8

Browse files
lcawlcoderabbitai[bot]cotti
authored
Add --report option for changelog add command (#3227)
* Add --report option for changelog add command * Update tests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Felipe Cotti <felipe.cotti@elastic.co>
1 parent a522f70 commit 705bde8

3 files changed

Lines changed: 193 additions & 22 deletions

File tree

docs/cli/changelog/add.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ docs-builder changelog add [options...] [-h|--help]
3030

3131
`--no-extract-release-notes`
3232
: Optional: Turn off extraction of release notes from PR or issue descriptions.
33-
: By default, the behavior is determined by the [extract.release_notes](/contribute/configure-changelogs-ref.md#extract) changelog configuration setting.
33+
: By default, the behavior is determined by the [extract.release_notes](/contribute/configure-changelogs-ref.md#extract) changelog configuration setting. Release notes are extracted when using `--prs` or `--report` (and from issues when using `--issues`).
3434

3535
`--feature-id <string?>`
3636
: Optional: Feature flag ID
@@ -50,18 +50,19 @@ docs-builder changelog add [options...] [-h|--help]
5050
: If `--owner` and `--repo` are provided, issue numbers can be used instead of URLs.
5151
: If specified, `--title` can be derived from the issue.
5252
: Creates one changelog file per issue.
53+
: Mutually exclusive with `--report`.
5354

5455
`--no-extract-issues`
5556
: Optional: Turn off extraction of linked references.
56-
: When using `--prs`: turns off extraction of linked issues from the PR body (for example, "Fixes #123").
57+
: When using `--prs` or `--report`: turns off extraction of linked issues from the PR body (for example, "Fixes #123").
5758
: When using `--issues`: turns off extraction of linked PRs from the issue body (for example, "Fixed by #123").
5859
: By default, the behavior is determined by the `extract.issues` changelog configuration setting.
5960

6061
`--output <string?>`
6162
: Optional: Output directory for the changelog fragment. Falls back to `bundle.directory` in `changelog.yml` when not specified. If that value is also absent, defaults to current directory.
6263

6364
`--owner <string?>`
64-
: Optional: GitHub repository owner (used when `--prs` or `--issues` contains just numbers, or when using `--release-version`).
65+
: Optional: GitHub repository owner (used when `--prs` or `--issues` contains just numbers, or when using `--release-version`). Not required when `--prs` or `--report` supplies only fully-qualified pull request URLs.
6566
: Falls back to `bundle.owner` in `changelog.yml` when not specified. If that value is also absent, defaults to `elastic`.
6667

6768
`--products <List<ProductInfo>>`
@@ -80,19 +81,26 @@ docs-builder changelog add [options...] [-h|--help]
8081
: If mappings are configured, `--areas`, `--type`, and `--products` can also be derived from the PR labels.
8182
: Creates one changelog file per PR.
8283
: If there are `rules.create` definitions in the changelog configuration file and a PR has a blocking label for the resolved products, that PR is skipped and no changelog file is created for it.
84+
: Mutually exclusive with `--report`.
8385

86+
`--report <string?>`
87+
: Optional: URL or path to a promotion report HTML document (for example a Buildkite promotion report). The command extracts GitHub pull request URLs from the HTML and creates one changelog file per PR, using the same parsing rules as [`changelog bundle --report`](/cli/changelog/bundle.md).
88+
: Mutually exclusive with `--prs`, `--issues`, and `--release-version`.
89+
: For a plain newline-delimited list of fully-qualified PR URLs, use `--prs` with a file path instead of `--report`.
90+
: When the value is an `https://` URL, only hosts allowed by the parser (such as `github.com` and `buildkite.com`) are supported, and the CLI needs network access to fetch the report.
8491
`--release-version <string?>`
8592
: Optional: GitHub release tag to use as a source of pull requests (for example, `"v9.2.0"` or `"latest"`).
8693
: When specified, the command fetches the release from GitHub, parses PR references from the release notes, and creates one changelog file per PR — without creating a bundle. Only automated GitHub release notes (the default format or [Release Drafter](https://github.com/release-drafter/release-drafter) format) are supported at this time.
8794
: Use `docs-builder changelog gh-release` instead if you also want a bundle.
8895
: Requires `--repo` (or `bundle.repo` in `changelog.yml`).
8996
: Set to `latest` to use the most recent release.
97+
: Mutually exclusive with `--report`, `--prs`, and `--issues`.
9098

9199
`--repo <string?>`
92-
: Optional: GitHub repository name (used when `--prs`, `--issues`, or `--release-version` is specified). Falls back to `bundle.repo` in `changelog.yml` when not specified.
100+
: Optional: GitHub repository name (used when `--prs`, `--issues`, `--report`, or `--release-version` is specified). Falls back to `bundle.repo` in `changelog.yml` when not specified.
93101

94102
`--strip-title-prefix`
95-
: Optional: When used with `--prs` or `--issues`, remove square brackets and text within them from the beginning of PR or issue titles, remove a colon if it follows the closing bracket, and remove a single ASCII hyphen when it's immediately after that prefix and followed by whitespace.
103+
: Optional: When used with `--prs`, `--issues`, or `--report`, remove square brackets and text within them from the beginning of PR or issue titles, remove a colon if it follows the closing bracket, and remove a single ASCII hyphen when it's immediately after that prefix and followed by whitespace.
96104
: For example, if a PR title is `"[Discover][ESQL]: Fix filtering by multiline string fields"` it becomes `"Fix filtering by multiline string fields"`.
97105
: Likewise `"[Cases] - Enable numerical id service"` becomes `"Enable numerical id service"`.
98106
: When a derived title still begins with `-`, `*`, `+`, an en dash, or an em dash, the emitted YAML uses a quoted `title` value so it is valid and unambiguous.
@@ -105,18 +113,18 @@ docs-builder changelog add [options...] [-h|--help]
105113

106114
`--title <string>`
107115
: A short, user-facing title (max 80 characters)
108-
: Required if neither `--prs` nor `--issues` is specified.
116+
: Required if none of `--prs`, `--issues`, or `--report` is specified.
109117
: If both `--prs` and `--title` are specified, the latter value is used instead of what exists in the PR.
110118
: If the content contains any special characters such as backquotes, you must precede it with a backslash escape character (`\`).
111119

112120
`--type <string>`
113-
: Required if neither `--prs` nor `--issues` is specified. Type of change (for example, `feature`, `enhancement`, `bug-fix`, or `breaking-change`).
121+
: Required if none of `--prs`, `--issues`, or `--report` is specified. Type of change (for example, `feature`, `enhancement`, `bug-fix`, or `breaking-change`).
114122
: If mappings are configured, type can be derived from the PR or issue.
115123
: The valid types are listed in [ChangelogConfiguration.cs](https://github.com/elastic/docs-builder/blob/main/src/services/Elastic.Documentation.Services/Changelog/ChangelogConfiguration.cs).
116124

117125
`--use-pr-number`
118126
: Optional: Use PR numbers for filenames instead of the configured `filename` strategy.
119-
: Requires `--prs` or `--issues`.
127+
: Requires `--prs`, `--issues`, or `--report`.
120128
: Mutually exclusive with `--use-issue-number`.
121129
: Refer to [](#filenames).
122130

@@ -153,7 +161,7 @@ docs-builder changelog add \
153161
```
154162

155163
:::{important}
156-
`--use-pr-number` and `--use-issue-number` are mutually exclusive; specify only one. Each requires `--prs` or `--issues`. The numbers are extracted from the URLs or identifiers you provide or from linked references in the issue or PR body when extraction is enabled.
164+
`--use-pr-number` and `--use-issue-number` are mutually exclusive; specify only one. `--use-pr-number` requires `--prs`, `--issues`, or `--report`. `--use-issue-number` requires `--prs` or `--issues`. The numbers are extracted from the URLs or identifiers you provide or from linked references in the issue or PR body when extraction is enabled.
157165

158166
**Precedence**: CLI flags (`--use-pr-number` / `--use-issue-number`) > `filename` in `changelog.yml` > default (`timestamp`).
159167
:::
@@ -181,6 +189,8 @@ The `changelog add` command resolves product values in the following order:
181189
1. If `products.default` is defined in the changelog configuration file, those default products are used.
182190
1. If `--repo` is specified (or `bundle.repo` is set in the changelog configuration file), the repository name is matched against known product IDs in `products.yml` and the derived value is used.
183191

192+
The same order applies when using `--report` (after PR URLs are resolved from the promotion report), and when using batch `--prs` with multiple pull requests.
193+
184194
If none of these steps yield at least one product, the command returns an error.
185195

186196
## Configuration checks

0 commit comments

Comments
 (0)