Skip to content

Commit

Permalink
fix: remove artifacts error comment whenever branch PR exists (#9029)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Mar 8, 2021
1 parent 86df157 commit 1024606
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/workers/branch/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ describe('workers/branch', () => {
commit.commitFilesToBranch.mockResolvedValueOnce(null);
await branchWorker.processBranch(config);
expect(prWorker.ensurePr).toHaveBeenCalledTimes(1);
expect(platform.ensureCommentRemoval).toHaveBeenCalledTimes(1);
expect(platform.ensureCommentRemoval).toHaveBeenCalledTimes(0);
expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(1);
});
it('ensures PR and adds lock file error comment if no releaseTimestamp', async () => {
Expand Down
28 changes: 14 additions & 14 deletions lib/workers/branch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,20 @@ export async function processBranch(
} else {
logger.debug('PR has no releaseTimestamp');
}
} else if (config.updatedArtifacts?.length && branchPr) {
// If there are artifacts, no errors, and an existing PR then ensure any artifacts error comment is removed
// istanbul ignore if
if (getAdminConfig().dryRun) {
logger.info(
`DRY-RUN: Would ensure comment removal in PR #${branchPr.number}`
);
} else {
// Remove artifacts error comment only if this run has successfully updated artifacts
await platform.ensureCommentRemoval({
number: branchPr.number,
topic: artifactErrorTopic,
});
}
}
config.forceCommit =
!!dependencyDashboardCheck ||
Expand Down Expand Up @@ -705,20 +719,6 @@ export async function processBranch(
}
}
} else {
if (config.updatedArtifacts?.length) {
// istanbul ignore if
if (getAdminConfig().dryRun) {
logger.info(
`DRY-RUN: Would ensure comment removal in PR #${pr.number}`
);
} else {
// Remove artifacts error comment only if this run has successfully updated artifacts
await platform.ensureCommentRemoval({
number: pr.number,
topic: artifactErrorTopic,
});
}
}
const prAutomerged = await checkAutoMerge(pr, config);
if (prAutomerged && config.automergeType !== 'pr-comment') {
await deleteBranchSilently(config.branchName);
Expand Down

0 comments on commit 1024606

Please sign in to comment.