fix(open-authoring): properly delete open authoring branches (#3512)
This commit is contained in:
parent
49098de27f
commit
cc89aa5c43
@ -712,16 +712,15 @@ export default class API {
|
||||
|
||||
filterOpenAuthoringBranches = async (branch: string) => {
|
||||
try {
|
||||
const contentKey = contentKeyFromBranch(branch);
|
||||
const { pullRequest, collection, slug } = await this.retrieveMetadata(contentKey);
|
||||
const pullRequest = await this.getBranchPullRequest(branch);
|
||||
const { state: currentState, merged_at: mergedAt } = pullRequest;
|
||||
if (
|
||||
pullRequest.number !== MOCK_PULL_REQUEST &&
|
||||
currentState === PullRequestState.Closed &&
|
||||
mergedAt
|
||||
) {
|
||||
// pr was merged, delete entry
|
||||
await this.deleteUnpublishedEntry(collection, slug);
|
||||
// pr was merged, delete branch
|
||||
await this.deleteBranch(branch);
|
||||
return { branch, filter: false };
|
||||
} else {
|
||||
return { branch, filter: true };
|
||||
|
Loading…
x
Reference in New Issue
Block a user