From 92b9e397a92f0393c4d5120b6908d4a0aa9c6174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E5=87=9B?= Date: Thu, 10 Feb 2022 13:52:56 +0800 Subject: [PATCH] test: getIssue --- dist/index.js | 14 +++++++------- src/issue/issue.ts | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dist/index.js b/dist/index.js index 8aa0aa0..029188f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -15673,7 +15673,8 @@ class IssueCoreEngine { repo, issue_number: issueNumber, }); - return issue; + console.log(issue); + return issue.data; }); } getUserPermission(username) { @@ -15754,8 +15755,8 @@ class IssueCoreEngine { } removeLabels(labels) { return __awaiter(this, void 0, void 0, function* () { - const { owner, repo, octokit, issueNumber, getIssue } = this; - const issue = yield getIssue(); + const { owner, repo, octokit, issueNumber } = this; + const issue = yield this.getIssue(); const baseLabels = issue.labels.map(({ name }) => name); const removeLabels = baseLabels.filter(name => labels.includes(name)); for (const label of removeLabels) { @@ -15773,8 +15774,7 @@ class IssueCoreEngine { // https://github.com/octokit/rest.js/issues/34 // - Probability to appear // - avoid use setLabels - const { getIssue } = this; - const issue = yield getIssue(); + const issue = yield this.getIssue(); const baseLabels = issue.labels.map(({ name }) => name); const removeLabels = baseLabels.filter(name => !labels.includes(name)); const addLabels = labels.filter(name => !baseLabels.includes(name)); @@ -15816,8 +15816,8 @@ class IssueCoreEngine { } updateIssue(state, title, body, mode, labels, assignees) { return __awaiter(this, void 0, void 0, function* () { - const { owner, repo, octokit, issueNumber, getIssue } = this; - const issue = yield getIssue(); + const { owner, repo, octokit, issueNumber } = this; + const issue = yield this.getIssue(); const { body: baseBody, title: baseTitle, labels: baseLabels, assignees: baseAssigness, state: baseState } = issue; const baseLabelsName = baseLabels.map(({ name }) => name); const baseAssignessName = baseAssigness === null || baseAssigness === void 0 ? void 0 : baseAssigness.map(({ login }) => login); diff --git a/src/issue/issue.ts b/src/issue/issue.ts index 41a99ce..bfc572d 100644 --- a/src/issue/issue.ts +++ b/src/issue/issue.ts @@ -136,7 +136,8 @@ export class IssueCoreEngine implements IIssueCoreEngine { repo, issue_number: issueNumber, }); - return issue as unknown as TIssueInfo; + console.log(issue) + return issue.data as unknown as TIssueInfo; } public async getUserPermission(username: string) { @@ -215,8 +216,8 @@ export class IssueCoreEngine implements IIssueCoreEngine { } public async removeLabels(labels: string[]) { - const { owner, repo, octokit, issueNumber, getIssue } = this; - const issue = await getIssue(); + const { owner, repo, octokit, issueNumber } = this; + const issue = await this.getIssue(); const baseLabels: string[] = issue.labels.map(({ name }) => name); const removeLabels = baseLabels.filter(name => labels.includes(name)); @@ -235,8 +236,7 @@ export class IssueCoreEngine implements IIssueCoreEngine { // https://github.com/octokit/rest.js/issues/34 // - Probability to appear // - avoid use setLabels - const { getIssue } = this; - const issue = await getIssue(); + const issue = await this.getIssue(); const baseLabels: string[] = issue.labels.map(({ name }: any) => name); const removeLabels = baseLabels.filter(name => !labels.includes(name)); @@ -279,8 +279,8 @@ export class IssueCoreEngine implements IIssueCoreEngine { } public async updateIssue(state: TIssueState, title: string | void, body: string | void, mode: TUpdateMode, labels?: string[] | void, assignees?: string[] | void) { - const { owner, repo, octokit, issueNumber, getIssue } = this; - const issue = await getIssue(); + const { owner, repo, octokit, issueNumber } = this; + const issue = await this.getIssue(); const { body: baseBody, title: baseTitle, labels: baseLabels, assignees: baseAssigness, state: baseState } = issue; const baseLabelsName = baseLabels.map(({ name }: any) => name);