Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
7c43dca9
Unverified
Commit
7c43dca9
authored
Apr 28, 2020
by
Marcus Efraimsson
Committed by
GitHub
Apr 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pagination of issues/PR's in changelog generator (#23997)
Fix pagination of issues/PR's in changelog generator
parent
c24ca8ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
6 deletions
+40
-6
packages/grafana-toolkit/src/cli/tasks/changelog.ts
+40
-6
No files found.
packages/grafana-toolkit/src/cli/tasks/changelog.ts
View file @
7c43dca9
...
...
@@ -57,7 +57,7 @@ const changelogTaskRunner: TaskRunner<ChangelogOptions> = useSpinner<ChangelogOp
return
;
}
cons
t
res
=
await
client
.
get
(
'/issues'
,
{
le
t
res
=
await
client
.
get
(
'/issues'
,
{
params
:
{
state
:
'closed'
,
per_page
:
100
,
...
...
@@ -66,8 +66,20 @@ const changelogTaskRunner: TaskRunner<ChangelogOptions> = useSpinner<ChangelogOp
},
});
const
data
:
any
[]
=
res
.
data
;
while
(
res
.
headers
.
link
)
{
const
links
=
parseLink
(
res
.
headers
.
link
);
if
(
links
.
next
)
{
res
=
await
client
.
get
(
links
.
next
);
data
.
push
(...
res
.
data
);
}
else
{
break
;
}
}
const
mergedIssues
=
[];
for
(
const
item
of
res
.
data
)
{
for
(
const
item
of
data
)
{
if
(
!
item
.
pull_request
)
{
// it's an issue, not pull request
mergedIssues
.
push
(
item
);
...
...
@@ -100,17 +112,39 @@ const changelogTaskRunner: TaskRunner<ChangelogOptions> = useSpinner<ChangelogOp
function
getMarkdownLineForIssue
(
item
:
any
)
{
const
githubGrafanaUrl
=
'https://github.com/grafana/grafana'
;
let
markdown
=
''
;
const
title
=
item
.
title
.
replace
(
/^
([^
:
]
*
)
/
,
(
_match
:
any
,
g1
:
any
)
=>
{
let
title
:
string
=
item
.
title
.
replace
(
/^
([^
:
]
*
)
/
,
(
_match
:
any
,
g1
:
any
)
=>
{
return
`**
${
g1
}
**`
;
});
title
=
title
.
trim
();
if
(
title
[
title
.
length
-
1
]
===
'.'
)
{
title
=
title
.
slice
(
0
,
-
1
);
}
markdown
+=
'* '
+
title
+
'.'
;
markdown
+=
` [#
${
item
.
number
}
](
${
githubGrafanaUrl
}
/pull/
${
item
.
number
}
)`
;
markdown
+=
`, [@
${
item
.
user
.
login
}
](
${
item
.
user
.
html_url
}
)`
;
if
(
!
item
.
pull_request
)
{
markdown
+=
'* '
+
title
+
'.'
;
markdown
+=
` [#
${
item
.
number
}
](
${
githubGrafanaUrl
}
/issues/
${
item
.
number
}
)`
;
}
else
{
markdown
+=
'* '
+
title
+
'.'
;
markdown
+=
` [#
${
item
.
number
}
](
${
githubGrafanaUrl
}
/pull/
${
item
.
number
}
)`
;
markdown
+=
`, [@
${
item
.
user
.
login
}
](
${
item
.
user
.
html_url
}
)`
;
}
markdown
+=
'
\
n'
;
return
markdown
;
}
function
parseLink
(
s
:
any
)
{
const
output
:
any
=
{};
const
regex
=
/<
([^
>
]
+
)
>; rel="
([^
"
]
+
)
"/g
;
let
m
;
while
((
m
=
regex
.
exec
(
s
)))
{
const
[,
v
,
k
]
=
m
;
output
[
k
]
=
v
;
}
return
output
;
}
export
const
changelogTask
=
new
Task
<
ChangelogOptions
>
(
'Changelog generator task'
,
changelogTaskRunner
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment