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
f5b1c00d
Commit
f5b1c00d
authored
7 years ago
by
Rhys Arkins
Browse files
Options
Downloads
Patches
Plain Diff
refactor: log old/new pr details if updating
parent
5f3649d1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/workers/pr/index.js
+19
-0
19 additions, 0 deletions
lib/workers/pr/index.js
test/workers/pr/__snapshots__/index.spec.js.snap
+26
-0
26 additions, 0 deletions
test/workers/pr/__snapshots__/index.spec.js.snap
test/workers/pr/index.spec.js
+9
-0
9 additions, 0 deletions
test/workers/pr/index.spec.js
with
54 additions
and
0 deletions
lib/workers/pr/index.js
+
19
−
0
View file @
f5b1c00d
...
...
@@ -170,6 +170,25 @@ async function ensurePr(prConfig) {
return
existingPr
;
}
// PR must need updating
if
(
existingPr
.
title
!==
prTitle
)
{
logger
.
debug
(
{
oldPrTitle
:
existingPr
.
title
,
newPrTitle
:
prTitle
,
},
'
PR title changed
'
);
}
else
{
logger
.
debug
(
{
prTitle
,
oldPrBody
:
existingPr
.
body
,
newPrBody
:
prBody
,
},
'
PR body changed
'
);
}
await
platform
.
updatePr
(
existingPr
.
number
,
prTitle
,
prBody
);
logger
.
info
({
pr
:
existingPr
.
displayNumber
},
`Updated PR`
);
return
existingPr
;
...
...
This diff is collapsed.
Click to expand it.
test/workers/pr/__snapshots__/index.spec.js.snap
+
26
−
0
View file @
f5b1c00d
...
...
@@ -102,6 +102,32 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).",
}
`;
exports[`workers/pr ensurePr should return modified existing PR title 1`] = `
Object {
"body": "This Pull Request updates dependency [dummy](https://github.com/renovateapp/dummy) from \`v1.0.0\` to \`v1.1.0\`
### Commits
<details>
<summary>renovateapp/dummy</summary>
#### 1.1.0
- [\`abcdefg\`](https://github.com/renovateapp/dummy/commit/abcdefghijklmnopqrstuvwxyz) foo [#3](https://github.com/renovateapp/dummy/issues/3)
</details>
---
This PR has been generated by [Renovate Bot](https://renovateapp.com).",
"displayNumber": "Existing PR",
"title": "wrong",
}
`;
exports[`workers/pr ensurePr should return unmodified existing PR 1`] = `Array []`;
exports[`workers/pr ensurePr should strip HTML PR for vsts 1`] = `
...
...
This diff is collapsed.
Click to expand it.
test/workers/pr/index.spec.js
+
9
−
0
View file @
f5b1c00d
...
...
@@ -272,6 +272,15 @@ describe('workers/pr', () => {
const
pr
=
await
prWorker
.
ensurePr
(
config
);
expect
(
pr
).
toMatchSnapshot
();
});
it
(
'
should return modified existing PR title
'
,
async
()
=>
{
config
.
newVersion
=
'
1.2.0
'
;
platform
.
getBranchPr
.
mockReturnValueOnce
({
...
existingPr
,
title
:
'
wrong
'
,
});
const
pr
=
await
prWorker
.
ensurePr
(
config
);
expect
(
pr
).
toMatchSnapshot
();
});
it
(
'
should create PR if branch tests failed
'
,
async
()
=>
{
config
.
automerge
=
true
;
config
.
automergeType
=
'
branch-push
'
;
...
...
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