Skip to content
Snippets Groups Projects
Commit f5b1c00d authored by Rhys Arkins's avatar Rhys Arkins
Browse files

refactor: log old/new pr details if updating

parent 5f3649d1
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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`] = `
......
......@@ -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';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment