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) => {
|
filterOpenAuthoringBranches = async (branch: string) => {
|
||||||
try {
|
try {
|
||||||
const contentKey = contentKeyFromBranch(branch);
|
const pullRequest = await this.getBranchPullRequest(branch);
|
||||||
const { pullRequest, collection, slug } = await this.retrieveMetadata(contentKey);
|
|
||||||
const { state: currentState, merged_at: mergedAt } = pullRequest;
|
const { state: currentState, merged_at: mergedAt } = pullRequest;
|
||||||
if (
|
if (
|
||||||
pullRequest.number !== MOCK_PULL_REQUEST &&
|
pullRequest.number !== MOCK_PULL_REQUEST &&
|
||||||
currentState === PullRequestState.Closed &&
|
currentState === PullRequestState.Closed &&
|
||||||
mergedAt
|
mergedAt
|
||||||
) {
|
) {
|
||||||
// pr was merged, delete entry
|
// pr was merged, delete branch
|
||||||
await this.deleteUnpublishedEntry(collection, slug);
|
await this.deleteBranch(branch);
|
||||||
return { branch, filter: false };
|
return { branch, filter: false };
|
||||||
} else {
|
} else {
|
||||||
return { branch, filter: true };
|
return { branch, filter: true };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user