Skip to content

Commit 35dbb66

Browse files
Spencerspalgerkibanamachine
authored
[release notes] extract "dev docs" comment too (#79351) (#79944)
Co-authored-by: spalger <[email protected]> Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: spalger <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
1 parent 7b5ef20 commit 35dbb66

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

docs/developer/contributing/index.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The Release Notes summarize what the PRs accomplish in language that is meaningf
4949

5050
The text that appears in the Release Notes is pulled directly from your PR title, or a single paragraph of text that you specify in the PR description.
5151

52-
To use a single paragraph of text, enter `Release note:` or a `## Release note` header in the PR description, followed by your text. For example, refer to this https://github.com/elastic/kibana/pull/65796[PR] that uses the `## Release note` header.
52+
To use a single paragraph of text, enter a `Release note:` or `## Release note` header in the PR description ("dev docs" works too), followed by your text. For example, refer to this https://github.com/elastic/kibana/pull/65796[PR] that uses the `## Release note` header.
5353

5454
When you create the Release Notes text, use the following best practices:
5555

packages/kbn-release-notes/src/lib/get_note_from_description.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ it('extracts expected components from html', () => {
3535
## Release Note:
3636
3737
Checkout this feature
38-
`)
38+
`),
39+
'release note'
3940
)
4041
).toMatchInlineSnapshot(`"Checkout this feature"`);
4142

@@ -46,10 +47,11 @@ it('extracts expected components from html', () => {
4647
4748
Fixes: #1234
4849
49-
#### Release Note:
50+
#### Dev docs:
5051
5152
We fixed an issue
52-
`)
53+
`),
54+
'dev docs'
5355
)
5456
).toMatchInlineSnapshot(`"We fixed an issue"`);
5557

@@ -60,8 +62,9 @@ it('extracts expected components from html', () => {
6062
6163
Fixes: #1234
6264
63-
Release note: Checkout feature foo
64-
`)
65+
OTHER TITLE: Checkout feature foo
66+
`),
67+
'other title'
6568
)
6669
).toMatchInlineSnapshot(`"Checkout feature foo"`);
6770

@@ -73,7 +76,8 @@ it('extracts expected components from html', () => {
7376
My PR description
7477
7578
release note : bar
76-
`)
79+
`),
80+
'release note'
7781
)
7882
).toMatchInlineSnapshot(`"bar"`);
7983
});

packages/kbn-release-notes/src/lib/get_note_from_description.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919

2020
import cheerio from 'cheerio';
2121

22-
export function getNoteFromDescription(descriptionHtml: string) {
22+
export function getNoteFromDescription(descriptionHtml: string, header: string) {
23+
const re = new RegExp(`^(\\s*${header.toLowerCase()}(?:s)?\\s*:?\\s*)`, 'i');
2324
const $ = cheerio.load(descriptionHtml);
2425
for (const el of $('p,h1,h2,h3,h4,h5').toArray()) {
2526
const text = $(el).text();
26-
const match = text.match(/^(\s*release note(?:s)?\s*:?\s*)/i);
27+
const match = text.match(re);
2728

2829
if (!match) {
2930
continue;

packages/kbn-release-notes/src/lib/pr_api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ export class PrApi {
178178
versions: labels
179179
.map((l) => Version.fromLabel(l))
180180
.filter((v): v is Version => v instanceof Version),
181-
note: getNoteFromDescription(node.bodyHTML),
181+
note:
182+
getNoteFromDescription(node.bodyHTML, 'release note') ||
183+
getNoteFromDescription(node.bodyHTML, 'dev docs'),
182184
};
183185
}
184186

0 commit comments

Comments
 (0)