Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
ee52021a
Unverified
Commit
ee52021a
authored
3 years ago
by
Gabriel-Ladzaretti
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(core/dashboard): GitHub error "maximum is 65536 characters" (#16208)
parent
84228b1b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/workers/repository/dependency-dashboard.spec.ts
+46
-0
46 additions, 0 deletions
lib/workers/repository/dependency-dashboard.spec.ts
lib/workers/repository/dependency-dashboard.ts
+1
-1
1 addition, 1 deletion
lib/workers/repository/dependency-dashboard.ts
with
47 additions
and
1 deletion
lib/workers/repository/dependency-dashboard.spec.ts
+
46
−
0
View file @
ee52021a
...
@@ -10,23 +10,54 @@ import {
...
@@ -10,23 +10,54 @@ import {
}
from
'
../../../test/util
'
;
}
from
'
../../../test/util
'
;
import
{
GlobalConfig
}
from
'
../../config/global
'
;
import
{
GlobalConfig
}
from
'
../../config/global
'
;
import
{
PlatformId
}
from
'
../../constants
'
;
import
{
PlatformId
}
from
'
../../constants
'
;
import
type
{
PackageDependency
,
PackageFile
,
}
from
'
../../modules/manager/types
'
;
import
type
{
Platform
}
from
'
../../modules/platform
'
;
import
type
{
Platform
}
from
'
../../modules/platform
'
;
import
{
massageMarkdown
}
from
'
../../modules/platform/github
'
;
import
{
BranchConfig
,
BranchResult
,
BranchUpgradeConfig
}
from
'
../types
'
;
import
{
BranchConfig
,
BranchResult
,
BranchUpgradeConfig
}
from
'
../types
'
;
import
*
as
dependencyDashboard
from
'
./dependency-dashboard
'
;
import
*
as
dependencyDashboard
from
'
./dependency-dashboard
'
;
import
{
PackageFiles
}
from
'
./package-files
'
;
import
{
PackageFiles
}
from
'
./package-files
'
;
type
PrUpgrade
=
BranchUpgradeConfig
;
type
PrUpgrade
=
BranchUpgradeConfig
;
const
massageMdSpy
=
jest
.
spyOn
(
platform
,
'
massageMarkdown
'
);
let
config
:
RenovateConfig
;
let
config
:
RenovateConfig
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
jest
.
clearAllMocks
();
jest
.
clearAllMocks
();
massageMdSpy
.
mockImplementation
(
massageMarkdown
);
config
=
getConfig
();
config
=
getConfig
();
config
.
platform
=
PlatformId
.
Github
;
config
.
platform
=
PlatformId
.
Github
;
config
.
errors
=
[];
config
.
errors
=
[];
config
.
warnings
=
[];
config
.
warnings
=
[];
});
});
function
genRandString
(
length
:
number
):
string
{
let
result
=
''
;
const
chars
=
'
abcdefghijklmnopqrstuvwxyz
'
;
const
charsLen
=
chars
.
length
;
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
result
+=
chars
.
charAt
(
Math
.
floor
(
Math
.
random
()
*
charsLen
));
}
return
result
;
}
function
genRandPackageFile
(
depsNum
:
number
,
depNameLen
:
number
):
Record
<
string
,
PackageFile
[]
>
{
const
deps
:
PackageDependency
[]
=
[];
for
(
let
i
=
0
;
i
<
depsNum
;
i
++
)
{
deps
.
push
({
depName
:
genRandString
(
depNameLen
),
currentVersion
:
'
1.0.0
'
,
});
}
return
{
npm
:
[{
packageFile
:
'
package.json
'
,
deps
}]
};
}
async
function
dryRun
(
async
function
dryRun
(
branches
:
BranchConfig
[],
branches
:
BranchConfig
[],
platform
:
jest
.
Mocked
<
Platform
>
,
platform
:
jest
.
Mocked
<
Platform
>
,
...
@@ -666,6 +697,21 @@ describe('workers/repository/dependency-dashboard', () => {
...
@@ -666,6 +697,21 @@ describe('workers/repository/dependency-dashboard', () => {
// same with dry run
// same with dry run
await
dryRun
(
branches
,
platform
);
await
dryRun
(
branches
,
platform
);
});
});
it
(
'
truncates the body of a really big repo
'
,
async
()
=>
{
const
branches
:
BranchConfig
[]
=
[];
const
truncatedLength
=
60000
;
const
packageFilesBigRepo
=
genRandPackageFile
(
100
,
700
);
PackageFiles
.
add
(
'
main
'
,
packageFilesBigRepo
);
await
dependencyDashboard
.
ensureDependencyDashboard
(
config
,
branches
);
expect
(
platform
.
ensureIssue
).
toHaveBeenCalledTimes
(
1
);
expect
(
platform
.
ensureIssue
.
mock
.
calls
[
0
][
0
].
body
).
toHaveLength
(
truncatedLength
);
// same with dry run
await
dryRun
(
branches
,
platform
);
});
});
});
});
});
});
});
...
...
This diff is collapsed.
Click to expand it.
lib/workers/repository/dependency-dashboard.ts
+
1
−
1
View file @
ee52021a
...
@@ -358,7 +358,7 @@ export async function ensureDependencyDashboard(
...
@@ -358,7 +358,7 @@ export async function ensureDependencyDashboard(
await
platform
.
ensureIssue
({
await
platform
.
ensureIssue
({
title
:
config
.
dependencyDashboardTitle
!
,
title
:
config
.
dependencyDashboardTitle
!
,
reuseTitle
,
reuseTitle
,
body
:
issueBody
,
body
:
platform
.
massageMarkdown
(
issueBody
)
,
labels
:
config
.
dependencyDashboardLabels
,
labels
:
config
.
dependencyDashboardLabels
,
confidential
:
config
.
confidential
,
confidential
:
config
.
confidential
,
});
});
...
...
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