Skip to content

Commit 27a4ae9

Browse files
lcawlgithub-code-quality[bot]cotti
authored
Add PR label blockers to changelog creation (#2350)
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Felipe Cotti <felipe.cotti@elastic.co>
1 parent aaded33 commit 27a4ae9

File tree

11 files changed

+1394
-201
lines changed

11 files changed

+1394
-201
lines changed

config/changelog.yml.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,17 @@ label_to_areas:
7676
# "area:index": index-management
7777
# "area:multiple": "search, security" # Multiple areas comma-separated
7878

79+
# Product-specific label blockers (optional)
80+
# Maps product IDs to lists of pull request labels that prevent changelog creation for that product
81+
# If you run the changelog add command with the --prs option and a PR has any of these labels, the changelog is not created
82+
# Product IDs can be comma-separated to share the same list of labels across multiple products
83+
add_blockers:
84+
# Example: Skip changelog creation for elasticsearch product when PR has these labels
85+
# elasticsearch:
86+
# - ">non-issue"
87+
# - ">test"
88+
# - ">refactoring"
89+
# Example: Share the same blockers across multiple products using comma-separated product IDs
90+
# elasticsearch, cloud-serverless:
91+
# - ">non-issue"
92+

docs-builder.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
<Project Path="tests/Elastic.Documentation.LegacyDocs.Tests/Elastic.Documentation.LegacyDocs.Tests.csproj" />
9191
<Project Path="tests/Elastic.Markdown.Tests/Elastic.Markdown.Tests.csproj" />
9292
<Project Path="tests/Navigation.Tests/Navigation.Tests.csproj" />
93+
<Project Path="tests/Elastic.Documentation.Services.Tests/Elastic.Documentation.Services.Tests.csproj" />
9394
</Folder>
9495
<Project Path=".github/.github.csproj">
9596
<Build Project="false" />

docs/cli/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ These commands can be roughly grouped into four main categories
1010
- [Documentation Set commands](#documentation-set-commands)
1111
- [Link commands](#link-commands)
1212
- [Assembler commands](#assembler-commands)
13-
- [Release doc commands](#release-doc-commands)
13+
- [Changelog commands](#changelog-commands)
1414

1515
### Global options
1616

@@ -47,7 +47,7 @@ Assembler builds bring together all isolated documentation set builds and turn t
4747

4848
[See available CLI commands for assembler](assembler/index.md)
4949

50-
## Release doc commands
50+
## Changelog commands
5151

5252
Commands that pertain to creating and publishing product release documentation.
5353

docs/cli/release/changelog-add.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,16 @@ docs-builder changelog add [options...] [-h|--help]
5050
: The valid product identifiers are listed in [products.yml](https://github.com/elastic/docs-builder/blob/main/config/products.yml).
5151
: The valid lifecycles are listed in [ChangelogConfiguration.cs](https://github.com/elastic/docs-builder/blob/main/src/services/Elastic.Documentation.Services/Changelog/ChangelogConfiguration.cs).
5252

53-
`--pr <string?>`
54-
: Optional: Pull request URL or number (if `--owner` and `--repo` are provided).
53+
`--prs <string[]?>`
54+
: Optional: Pull request URLs or numbers (comma-separated), or a path to a newline-delimited file containing PR URLs or numbers. Can be specified multiple times.
55+
: Each occurrence can be either comma-separated PRs (e.g., `--prs "https://github.com/owner/repo/pull/123,6789"`) or a file path (e.g., `--prs /path/to/file.txt`).
56+
: When specifying PRs directly, provide comma-separated values.
57+
: When specifying a file path, provide a single value that points to a newline-delimited file.
58+
: If `--owner` and `--repo` are provided, PR numbers can be used instead of URLs.
5559
: If specified, `--title` can be derived from the PR.
5660
: If mappings are configured, `--areas` and `--type` can also be derived from the PR.
61+
: Creates one changelog file per PR.
62+
: If `add_blockers` are configured in the changelog configuration file and a PR has a blocking label for any product in `--products`, that PR is skipped and no changelog file is created for it.
5763

5864
`--repo <string?>`
5965
: Optional: GitHub repository name (used when `--pr` is just a number).

docs/cli/release/index.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
---
2-
navigation_title: "release"
2+
navigation_title: "changelog"
33
---
44

5-
# Release doc commands
5+
# Changelog commands
66

77
These commands are associated with product release documentation.
88

9-
## Changelog commands
10-
119
- [changelog add](changelog-add.md) - Create a changelog file

docs/contribute/changelog.md

Lines changed: 150 additions & 58 deletions
Large diffs are not rendered by default.

src/services/Elastic.Documentation.Services/Changelog/ChangelogConfiguration.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ public class ChangelogConfiguration
5757
/// </summary>
5858
public Dictionary<string, string>? LabelToAreas { get; set; }
5959

60+
/// <summary>
61+
/// Product-specific label blocking configuration
62+
/// Maps product IDs to lists of labels that should prevent changelog creation for that product
63+
/// Keys can be comma-separated product IDs to share the same list of labels across multiple products
64+
/// </summary>
65+
public Dictionary<string, List<string>>? AddBlockers { get; set; }
66+
6067
public static ChangelogConfiguration Default => new();
6168
}
6269

src/services/Elastic.Documentation.Services/Changelog/ChangelogInput.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ChangelogInput
1414
public required List<ProductInfo> Products { get; set; }
1515
public string? Subtype { get; set; }
1616
public string[] Areas { get; set; } = [];
17-
public string? Pr { get; set; }
17+
public string[]? Prs { get; set; }
1818
public string? Owner { get; set; }
1919
public string? Repo { get; set; }
2020
public string[] Issues { get; set; } = [];

0 commit comments

Comments
 (0)