Skip deleting the branch in the upstream of a forkerd repo
This commit is contained in:
parent
b1e5ead0b2
commit
dad3c0f9e0
|
@ -921,26 +921,41 @@ export class IssuesProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
const branch = pullRequest.head.ref;
|
const branch = pullRequest.head.ref;
|
||||||
issueLogger.info(
|
|
||||||
`Deleting the branch "${LoggerService.cyan(branch)}" from closed $$type`
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
if (
|
||||||
this._consumeIssueOperation(issue);
|
pullRequest.head.repo === null ||
|
||||||
this.statistics?.incrementDeletedBranchesCount();
|
pullRequest.head.repo.full_name ===
|
||||||
|
`${context.repo.owner}/${context.repo.repo}`
|
||||||
|
) {
|
||||||
|
issueLogger.info(
|
||||||
|
`Deleting the branch "${LoggerService.cyan(branch)}" from closed $$type`
|
||||||
|
);
|
||||||
|
|
||||||
if (!this.options.debugOnly) {
|
try {
|
||||||
await this.client.rest.git.deleteRef({
|
this._consumeIssueOperation(issue);
|
||||||
owner: context.repo.owner,
|
this.statistics?.incrementDeletedBranchesCount();
|
||||||
repo: context.repo.repo,
|
|
||||||
ref: `heads/${branch}`
|
if (!this.options.debugOnly) {
|
||||||
});
|
await this.client.rest.git.deleteRef({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
ref: `heads/${branch}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
issueLogger.error(
|
||||||
|
`Error when deleting the branch "${LoggerService.cyan(
|
||||||
|
branch
|
||||||
|
)}" from $$type: ${error.message}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} else {
|
||||||
issueLogger.error(
|
issueLogger.warning(
|
||||||
`Error when deleting the branch "${LoggerService.cyan(
|
`Deleting the branch "${LoggerService.cyan(
|
||||||
branch
|
branch
|
||||||
)}" from $$type: ${error.message}`
|
)}" has skipped because it belongs to other repo ${
|
||||||
|
pullRequest.head.repo.full_name
|
||||||
|
}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@ export interface IPullRequest {
|
||||||
number: number;
|
number: number;
|
||||||
head: {
|
head: {
|
||||||
ref: string;
|
ref: string;
|
||||||
|
repo: {
|
||||||
|
full_name: string;
|
||||||
|
} | null;
|
||||||
};
|
};
|
||||||
draft?: boolean;
|
draft?: boolean;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue