optimize pull request
This commit is contained in:
parent
02989dcb65
commit
51c18470e1
|
@ -169,12 +169,18 @@ class ExemptDraftPullRequest {
|
|||
this._issueLogger = new issue_logger_1.IssueLogger(issue);
|
||||
}
|
||||
shouldExemptDraftPullRequest(pullRequestCallback) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this._issue.isPullRequest) {
|
||||
if (this._options.exemptDraftPr) {
|
||||
this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptDraftPr)} is enabled`);
|
||||
const pullRequest = yield pullRequestCallback();
|
||||
if ((pullRequest === null || pullRequest === void 0 ? void 0 : pullRequest.draft) === true) {
|
||||
/*
|
||||
const pullRequest: IPullRequest | undefined | void =
|
||||
await pullRequestCallback();
|
||||
|
||||
if (pullRequest?.draft === true) {
|
||||
*/
|
||||
if (((_a = this._issue) === null || _a === void 0 ? void 0 : _a.draft) === true) {
|
||||
this._issueLogger.info(logger_service_1.LoggerService.white('└──'), `Skip the $$type draft checks`);
|
||||
return true;
|
||||
}
|
||||
|
@ -271,6 +277,7 @@ class Issue {
|
|||
this.number = issue.number;
|
||||
this.created_at = issue.created_at;
|
||||
this.updated_at = issue.updated_at;
|
||||
this.draft = issue.draft || false;
|
||||
this.labels = mapLabels(issue.labels);
|
||||
this.pull_request = issue.pull_request;
|
||||
this.state = issue.state;
|
||||
|
|
|
@ -27,10 +27,13 @@ export class ExemptDraftPullRequest {
|
|||
)} is enabled`
|
||||
);
|
||||
|
||||
/* This code was used until Jun 15 2022 - it is unclear why they had to call API for getting pull request
|
||||
const pullRequest: IPullRequest | undefined | void =
|
||||
await pullRequestCallback();
|
||||
|
||||
if (pullRequest?.draft === true) {
|
||||
*/
|
||||
if (this._issue?.draft === true) {
|
||||
this._issueLogger.info(
|
||||
LoggerService.white('└──'),
|
||||
`Skip the $$type draft checks`
|
||||
|
|
|
@ -13,6 +13,7 @@ export class Issue implements IIssue {
|
|||
readonly number: number;
|
||||
created_at: IsoDateString;
|
||||
updated_at: IsoDateString;
|
||||
readonly draft: boolean;
|
||||
readonly labels: ILabel[];
|
||||
readonly pull_request: object | null | undefined;
|
||||
readonly state: string | 'closed' | 'open';
|
||||
|
@ -33,6 +34,7 @@ export class Issue implements IIssue {
|
|||
this.number = issue.number;
|
||||
this.created_at = issue.created_at;
|
||||
this.updated_at = issue.updated_at;
|
||||
this.draft = issue.draft || false;
|
||||
this.labels = mapLabels(issue.labels);
|
||||
this.pull_request = issue.pull_request;
|
||||
this.state = issue.state;
|
||||
|
|
|
@ -8,6 +8,7 @@ export interface IIssue {
|
|||
number: number;
|
||||
created_at: IsoDateString;
|
||||
updated_at: IsoDateString;
|
||||
draft: boolean;
|
||||
labels: ILabel[];
|
||||
pull_request?: object | null;
|
||||
state: string;
|
||||
|
|
Loading…
Reference in New Issue