Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
db8581f4
Unverified
Commit
db8581f4
authored
1 month ago
by
RahulGautamSingh
Committed by
GitHub
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
docs: use issueType field for docs generation (#33718)
Co-authored-by:
Rhys Arkins
<
rhys@arkins.net
>
parent
8f975309
No related branches found
Branches containing commit
Tags
36.1.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/development/local-development.md
+3
-0
3 additions, 0 deletions
docs/development/local-development.md
tools/docs/github-query-items.ts
+50
-37
50 additions, 37 deletions
tools/docs/github-query-items.ts
with
53 additions
and
37 deletions
docs/development/local-development.md
+
3
−
0
View file @
db8581f4
...
...
@@ -182,6 +182,9 @@ You can run `pnpm build:docs` to generate the docs.
Then use
`pnpm mkdocs serve`
to preview the documentation locally.
The docs will update automatically when you run
`pnpm build:docs`
again, no need to stop the
`pnpm mkdocs serve`
command.
Also, make sure to set the
`GITHUB_TOKEN`
in your environment as we use
[
gh cli
](
https://cli.github.com/manual/gh_issue_list
)
to fetch the issues.
If you wish to skip fetching the issues, then set
`SKIP_GITHUB_ISSUES`
to
`true`
before building the docs.
## Keeping your Renovate fork up to date
First of all, never commit to the
`main`
branch of your fork - always use a "feature" branch like
`feat/1234-add-yarn-parsing`
.
...
...
This diff is collapsed.
Click to expand it.
tools/docs/github-query-items.ts
+
50
−
37
View file @
db8581f4
import
{
DateTime
}
from
'
luxon
'
;
import
{
z
}
from
'
zod
'
;
import
{
logger
}
from
'
../../lib/logger
'
;
import
*
as
hostRules
from
'
../../lib/util/host-rules
'
;
import
{
GithubHttp
}
from
'
../../lib/util/http/github
'
;
import
{
getQueryString
}
from
'
../../lib/util/url
'
;
const
gitHubApiUrl
=
'
https://api.github.com/search/issues?
'
;
const
githubApi
=
new
GithubHttp
();
if
(
process
.
env
.
GITHUB_TOKEN
)
{
logger
.
info
(
'
Using GITHUB_TOKEN from env
'
);
hostRules
.
add
({
matchHost
:
'
api.github.com
'
,
token
:
process
.
env
.
GITHUB_TOKEN
,
});
}
type
GithubApiQueryResponse
=
{
total_count
:
number
;
incomplete_results
:
boolean
;
items
:
ItemsEntity
[];
};
import
{
exec
}
from
'
../../lib/util/exec
'
;
export
type
ItemsEntity
=
{
html_
url
:
string
;
url
:
string
;
number
:
number
;
title
:
string
;
labels
:
LabelsEntity
[];
issueType
:
'
Bug
'
|
'
Feature
'
;
};
export
type
LabelsEntity
=
{
...
...
@@ -46,6 +29,34 @@ export interface Items {
features
:
ItemsEntity
[];
}
const
GhOutputSchema
=
z
.
array
(
z
.
object
({
url
:
z
.
string
(),
title
:
z
.
string
(),
labels
:
z
.
array
(
z
.
object
({
name
:
z
.
string
(),
}),
),
number
:
z
.
number
(),
}),
);
async
function
getIssuesByIssueType
(
issueType
:
'
Bug
'
|
'
Feature
'
,
):
Promise
<
ItemsEntity
[]
>
{
const
command
=
`gh issue list --json "title,number,url,labels" --search "type:
${
issueType
}
" --limit 1000`
;
const
execRes
=
await
exec
(
command
);
const
res
=
GhOutputSchema
.
safeParse
(
JSON
.
parse
(
execRes
.
stdout
));
if
(
res
.
error
)
{
throw
res
.
error
;
}
return
res
.
data
.
map
((
issue
)
=>
{
return
{
...
issue
,
issueType
};
});
}
export
async
function
getOpenGitHubItems
():
Promise
<
RenovateOpenItems
>
{
const
result
:
RenovateOpenItems
=
{
managers
:
{},
...
...
@@ -59,18 +70,21 @@ export async function getOpenGitHubItems(): Promise<RenovateOpenItems> {
return
result
;
}
const
q
=
`repo:renovatebot/renovate type:issue is:open`
;
const
per_page
=
100
;
if
(
!
process
.
env
.
GITHUB_TOKEN
)
{
logger
.
warn
(
'
No GITHUB_TOKEN found in env, cannot fetch Github issues. Skipping...
'
,
);
return
result
;
}
if
(
process
.
env
.
CI
)
{
return
result
;
}
try
{
const
query
=
getQueryString
({
q
,
per_page
});
const
res
=
await
githubApi
.
getJsonUnchecked
<
GithubApiQueryResponse
>
(
gitHubApiUrl
+
query
,
{
paginationField
:
'
items
'
,
paginate
:
true
,
},
const
rawItems
=
(
await
getIssuesByIssueType
(
'
Bug
'
)).
concat
(
await
getIssuesByIssueType
(
'
Feature
'
),
);
const
rawItems
=
res
.
body
?.
items
??
[];
result
.
managers
=
extractIssues
(
rawItems
,
'
manager:
'
);
result
.
platforms
=
extractIssues
(
rawItems
,
'
platform:
'
);
...
...
@@ -91,9 +105,8 @@ function extractIssues(items: ItemsEntity[], labelPrefix: string): OpenItems {
const
issuesMap
:
OpenItems
=
{};
for
(
const
item
of
items
)
{
const
type
=
item
.
labels
.
find
((
l
)
=>
l
.
name
.
startsWith
(
'
type:
'
))
?.
name
.
split
(
'
:
'
)[
1
];
const
type
=
item
.
issueType
;
if
(
!
type
)
{
continue
;
}
...
...
@@ -107,10 +120,10 @@ function extractIssues(items: ItemsEntity[], labelPrefix: string): OpenItems {
issuesMap
[
label
]
=
{
bugs
:
[],
features
:
[]
};
}
switch
(
type
)
{
case
'
b
ug
'
:
case
'
B
ug
'
:
issuesMap
[
label
]?.
bugs
.
push
(
item
);
break
;
case
'
f
eature
'
:
case
'
F
eature
'
:
issuesMap
[
label
]?.
features
.
push
(
item
);
break
;
default
:
...
...
@@ -127,7 +140,7 @@ function stringifyIssues(items: ItemsEntity[] | undefined): string {
}
let
list
=
''
;
for
(
const
item
of
items
)
{
list
+=
` -
${
item
.
title
}
[#
${
item
.
number
}
](
${
item
.
html_
url
}
)\n`
;
list
+=
` -
${
item
.
title
}
[#
${
item
.
number
}
](
${
item
.
url
}
)\n`
;
}
return
list
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment