Merge pull request #913 from akv-platform/v-sdolin/push-ref
Skip deleting the branch in the upstream of a forked repo
This commit is contained in:
commit
c4a13d8dca
|
@ -130,7 +130,8 @@ class IssuesProcessorBuilder {
|
|||
number: 0,
|
||||
draft: true,
|
||||
head: {
|
||||
ref: 'ref'
|
||||
ref: 'ref',
|
||||
repo: null
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -921,6 +921,9 @@ class IssuesProcessor {
|
|||
return;
|
||||
}
|
||||
const branch = pullRequest.head.ref;
|
||||
if (pullRequest.head.repo === null ||
|
||||
pullRequest.head.repo.full_name ===
|
||||
`${github_1.context.repo.owner}/${github_1.context.repo.repo}`) {
|
||||
issueLogger.info(`Deleting the branch "${logger_service_1.LoggerService.cyan(branch)}" from closed $$type`);
|
||||
try {
|
||||
this._consumeIssueOperation(issue);
|
||||
|
@ -936,6 +939,10 @@ class IssuesProcessor {
|
|||
catch (error) {
|
||||
issueLogger.error(`Error when deleting the branch "${logger_service_1.LoggerService.cyan(branch)}" from $$type: ${error.message}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
issueLogger.warning(`Deleting the branch "${logger_service_1.LoggerService.cyan(branch)}" has skipped because it belongs to other repo ${pullRequest.head.repo.full_name}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Remove a label from an issue or a pull request
|
||||
|
|
|
@ -921,6 +921,12 @@ export class IssuesProcessor {
|
|||
}
|
||||
|
||||
const branch = pullRequest.head.ref;
|
||||
|
||||
if (
|
||||
pullRequest.head.repo === null ||
|
||||
pullRequest.head.repo.full_name ===
|
||||
`${context.repo.owner}/${context.repo.repo}`
|
||||
) {
|
||||
issueLogger.info(
|
||||
`Deleting the branch "${LoggerService.cyan(branch)}" from closed $$type`
|
||||
);
|
||||
|
@ -943,6 +949,15 @@ export class IssuesProcessor {
|
|||
)}" from $$type: ${error.message}`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
issueLogger.warning(
|
||||
`Deleting the branch "${LoggerService.cyan(
|
||||
branch
|
||||
)}" has skipped because it belongs to other repo ${
|
||||
pullRequest.head.repo.full_name
|
||||
}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove a label from an issue or a pull request
|
||||
|
|
|
@ -2,6 +2,9 @@ export interface IPullRequest {
|
|||
number: number;
|
||||
head: {
|
||||
ref: string;
|
||||
repo: {
|
||||
full_name: string;
|
||||
} | null;
|
||||
};
|
||||
draft?: boolean;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue