diff --git a/dist/index.js b/dist/index.js index 6937fa60..b348fc3d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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; diff --git a/src/classes/exempt-draft-pull-request.ts b/src/classes/exempt-draft-pull-request.ts index ae5e979a..1cdb17a2 100644 --- a/src/classes/exempt-draft-pull-request.ts +++ b/src/classes/exempt-draft-pull-request.ts @@ -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` diff --git a/src/classes/issue.ts b/src/classes/issue.ts index 7ddf9289..bd4d16e0 100644 --- a/src/classes/issue.ts +++ b/src/classes/issue.ts @@ -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; diff --git a/src/interfaces/issue.ts b/src/interfaces/issue.ts index 2110e2fc..defdb75d 100644 --- a/src/interfaces/issue.ts +++ b/src/interfaces/issue.ts @@ -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;