mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
7b5ef20a58
commit
35dbb663b3
4 changed files with 17 additions and 10 deletions
|
@ -49,7 +49,7 @@ The Release Notes summarize what the PRs accomplish in language that is meaningf
|
|||
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
When you create the Release Notes text, use the following best practices:
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ it('extracts expected components from html', () => {
|
|||
## Release Note:
|
||||
|
||||
Checkout this feature
|
||||
`)
|
||||
`),
|
||||
'release note'
|
||||
)
|
||||
).toMatchInlineSnapshot(`"Checkout this feature"`);
|
||||
|
||||
|
@ -46,10 +47,11 @@ it('extracts expected components from html', () => {
|
|||
|
||||
Fixes: #1234
|
||||
|
||||
#### Release Note:
|
||||
#### Dev docs:
|
||||
|
||||
We fixed an issue
|
||||
`)
|
||||
`),
|
||||
'dev docs'
|
||||
)
|
||||
).toMatchInlineSnapshot(`"We fixed an issue"`);
|
||||
|
||||
|
@ -60,8 +62,9 @@ it('extracts expected components from html', () => {
|
|||
|
||||
Fixes: #1234
|
||||
|
||||
Release note: Checkout feature foo
|
||||
`)
|
||||
OTHER TITLE: Checkout feature foo
|
||||
`),
|
||||
'other title'
|
||||
)
|
||||
).toMatchInlineSnapshot(`"Checkout feature foo"`);
|
||||
|
||||
|
@ -73,7 +76,8 @@ it('extracts expected components from html', () => {
|
|||
My PR description
|
||||
|
||||
release note : bar
|
||||
`)
|
||||
`),
|
||||
'release note'
|
||||
)
|
||||
).toMatchInlineSnapshot(`"bar"`);
|
||||
});
|
||||
|
|
|
@ -19,11 +19,12 @@
|
|||
|
||||
import cheerio from 'cheerio';
|
||||
|
||||
export function getNoteFromDescription(descriptionHtml: string) {
|
||||
export function getNoteFromDescription(descriptionHtml: string, header: string) {
|
||||
const re = new RegExp(`^(\\s*${header.toLowerCase()}(?:s)?\\s*:?\\s*)`, 'i');
|
||||
const $ = cheerio.load(descriptionHtml);
|
||||
for (const el of $('p,h1,h2,h3,h4,h5').toArray()) {
|
||||
const text = $(el).text();
|
||||
const match = text.match(/^(\s*release note(?:s)?\s*:?\s*)/i);
|
||||
const match = text.match(re);
|
||||
|
||||
if (!match) {
|
||||
continue;
|
||||
|
|
|
@ -178,7 +178,9 @@ export class PrApi {
|
|||
versions: labels
|
||||
.map((l) => Version.fromLabel(l))
|
||||
.filter((v): v is Version => v instanceof Version),
|
||||
note: getNoteFromDescription(node.bodyHTML),
|
||||
note:
|
||||
getNoteFromDescription(node.bodyHTML, 'release note') ||
|
||||
getNoteFromDescription(node.bodyHTML, 'dev docs'),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue