accept-to-ship-action 0.7.8 → 0.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  import type { Octokit } from '@octokit/core';
2
- import type { Api } from '@octokit/plugin-rest-endpoint-methods/dist-types/types';
2
+ import type { Api } from '@octokit/plugin-rest-endpoint-methods';
3
3
  export declare function canRepoAutoMerge(owner: string, repo: string, octokit: Octokit & Api): Promise<boolean>;
@@ -1,27 +1,13 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.canRepoAutoMerge = canRepoAutoMerge;
13
- function canRepoAutoMerge(owner, repo, octokit) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- const { repository: { autoMergeAllowed }, } = yield octokit.graphql(`
1
+ export async function canRepoAutoMerge(owner, repo, octokit) {
2
+ const { repository: { autoMergeAllowed }, } = await octokit.graphql(`
16
3
  query($owner: String!, $repo: String!) {
17
4
  repository(owner: $owner, name: $repo) {
18
5
  autoMergeAllowed
19
6
  }
20
7
  }
21
8
  `, {
22
- owner,
23
- repo,
24
- });
25
- return autoMergeAllowed;
9
+ owner,
10
+ repo,
26
11
  });
12
+ return autoMergeAllowed;
27
13
  }
@@ -1,5 +1,4 @@
1
1
  import type { Octokit } from '@octokit/core';
2
- import type { Api } from '@octokit/plugin-rest-endpoint-methods/dist-types/types';
3
- import { PullRequest } from '@octokit/webhooks-types/schema';
4
- import { getMergeMethod } from './getMergeMethod';
5
- export declare function enablePullRequestAutoMerge(owner: string, repo: string, pullRequest: PullRequest, pullRequestId: string, mergeMethod: ReturnType<typeof getMergeMethod>, octokit: Octokit & Api): Promise<void>;
2
+ import type { Api, RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';
3
+ import { getMergeMethod } from './getMergeMethod.js';
4
+ export declare function enablePullRequestAutoMerge(owner: string, repo: string, pullRequest: RestEndpointMethodTypes['pulls']['get']['response']['data'], pullRequestId: string, mergeMethod: ReturnType<typeof getMergeMethod>, octokit: Octokit & Api): Promise<void>;
@@ -1,86 +1,71 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.enablePullRequestAutoMerge = enablePullRequestAutoMerge;
13
- const core_1 = require("@actions/core");
14
- const github_1 = require("@actions/github");
15
- const request_error_1 = require("@octokit/request-error");
16
- const isPullRequestMerged_1 = require("./isPullRequestMerged");
17
- function enablePullRequestAutoMerge(owner, repo, pullRequest, pullRequestId, mergeMethod, octokit) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- var _a, _b;
20
- const pullRequestNumber = pullRequest.number;
21
- try {
22
- yield octokit.graphql(`
1
+ import { error, info, setFailed, setOutput, warning } from '@actions/core';
2
+ import { context } from '@actions/github';
3
+ import { RequestError } from '@octokit/request-error';
4
+ import { isPullRequestMerged } from './isPullRequestMerged.js';
5
+ export async function enablePullRequestAutoMerge(owner, repo, pullRequest, pullRequestId, mergeMethod, octokit) {
6
+ const pullRequestNumber = pullRequest.number;
7
+ try {
8
+ await octokit.graphql(`
23
9
  mutation($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod) {
24
10
  enablePullRequestAutoMerge(input: { pullRequestId: $pullRequestId, mergeMethod: $mergeMethod }) {
25
11
  clientMutationId
26
12
  }
27
13
  }
28
14
  `, {
29
- pullRequestId,
30
- mergeMethod: mergeMethod.toUpperCase(),
15
+ pullRequestId,
16
+ mergeMethod: mergeMethod.toUpperCase(),
17
+ });
18
+ setOutput('skipped', false);
19
+ try {
20
+ info(`Run ID: ${context.runId}`);
21
+ const { data: job } = await octokit.rest.actions.getWorkflowRun({
22
+ owner,
23
+ repo,
24
+ run_id: context.runId,
31
25
  });
32
- (0, core_1.setOutput)('skipped', false);
33
- try {
34
- (0, core_1.info)(`Run ID: ${github_1.context.runId}`);
35
- const { data: job } = yield octokit.rest.actions.getWorkflowRun({
36
- owner,
37
- repo,
38
- run_id: github_1.context.runId,
39
- });
40
- (0, core_1.info)(`Job ID: ${job.id} (${job.html_url})`);
41
- const { data: comment } = yield octokit.rest.issues.createComment({
42
- owner,
43
- repo,
44
- issue_number: pullRequestNumber,
45
- body: `Auto-merge is enabled by a [GitHub Action](${job.html_url})`,
46
- });
47
- (0, core_1.info)(`Comment is created: ${comment.html_url}`);
48
- }
49
- catch (requestError) {
50
- if (requestError instanceof request_error_1.RequestError) {
51
- (0, core_1.info)(`Failed to comment on the Pull Request: [${requestError.status}] ${requestError.message}`);
52
- }
53
- }
26
+ info(`Job ID: ${job.id} (${job.html_url})`);
27
+ const { data: comment } = await octokit.rest.issues.createComment({
28
+ owner,
29
+ repo,
30
+ issue_number: pullRequestNumber,
31
+ body: `Auto-merge is enabled by a [GitHub Action](${job.html_url})`,
32
+ });
33
+ info(`Comment is created: ${comment.html_url}`);
54
34
  }
55
35
  catch (requestError) {
56
- if (requestError instanceof request_error_1.RequestError) {
57
- (0, core_1.warning)(`Failed to enable auto-merge for the Pull Request: [${requestError.status}] ${requestError.message}`);
58
- // If it's merged by someone else in a race condition we treat it as skipped,
59
- // because it's the same as someone else merged it before we try.
60
- const merged = yield (0, isPullRequestMerged_1.isPullRequestMerged)(owner, repo, pullRequestNumber, octokit);
61
- (0, core_1.setOutput)('skipped', !merged);
62
- if (merged) {
63
- try {
64
- const { data: pullRequest } = yield octokit.rest.pulls.get({
65
- owner,
66
- repo,
67
- pull_number: pullRequestNumber,
68
- });
69
- (0, core_1.warning)(`This Pull Request has been merged by: ${(_a = pullRequest.merged_by) === null || _a === void 0 ? void 0 : _a.login} (${(_b = pullRequest.merged_by) === null || _b === void 0 ? void 0 : _b.html_url})`);
70
- }
71
- catch (_c) {
72
- (0, core_1.warning)(`This Pull Request has been merged by unknown user.`);
73
- }
36
+ if (requestError instanceof RequestError) {
37
+ info(`Failed to comment on the Pull Request: [${requestError.status}] ${requestError.message}`);
38
+ }
39
+ }
40
+ }
41
+ catch (requestError) {
42
+ if (requestError instanceof RequestError) {
43
+ warning(`Failed to enable auto-merge for the Pull Request: [${requestError.status}] ${requestError.message}`);
44
+ // If it's merged by someone else in a race condition we treat it as skipped,
45
+ // because it's the same as someone else merged it before we try.
46
+ const merged = await isPullRequestMerged(owner, repo, pullRequestNumber, octokit);
47
+ setOutput('skipped', !merged);
48
+ if (merged) {
49
+ try {
50
+ const { data: pullRequest } = await octokit.rest.pulls.get({
51
+ owner,
52
+ repo,
53
+ pull_number: pullRequestNumber,
54
+ });
55
+ warning(`This Pull Request has been merged by: ${pullRequest.merged_by?.login} (${pullRequest.merged_by?.html_url})`);
74
56
  }
75
- else {
76
- // If it's not merged by someone else in a race condition then we treat it as a real error.
77
- (0, core_1.error)(`This Pull Request remains unmerged.`);
78
- (0, core_1.setFailed)(`Failed to merge this Pull Request when conditions are met.`);
57
+ catch {
58
+ warning(`This Pull Request has been merged by unknown user.`);
79
59
  }
80
60
  }
81
61
  else {
82
- throw requestError;
62
+ // If it's not merged by someone else in a race condition then we treat it as a real error.
63
+ error(`This Pull Request remains unmerged.`);
64
+ setFailed(`Failed to merge this Pull Request when conditions are met.`);
83
65
  }
84
66
  }
85
- });
67
+ else {
68
+ throw requestError;
69
+ }
70
+ }
86
71
  }
@@ -1,5 +1,5 @@
1
1
  import type { Octokit } from '@octokit/core';
2
- import type { Api } from '@octokit/plugin-rest-endpoint-methods/dist-types/types';
2
+ import type { Api } from '@octokit/plugin-rest-endpoint-methods';
3
3
  export declare function getCheckRuns(owner: string, repo: string, ref: string, octokit: Octokit & Api): Promise<{
4
4
  id: number;
5
5
  head_sha: string;
@@ -8,7 +8,7 @@ export declare function getCheckRuns(owner: string, repo: string, ref: string, o
8
8
  url: string;
9
9
  html_url: string | null;
10
10
  details_url: string | null;
11
- status: "queued" | "in_progress" | "completed";
11
+ status: "queued" | "in_progress" | "completed" | "waiting" | "requested" | "pending";
12
12
  conclusion: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required" | null;
13
13
  started_at: string | null;
14
14
  completed_at: string | null;
@@ -23,138 +23,7 @@ export declare function getCheckRuns(owner: string, repo: string, ref: string, o
23
23
  check_suite: {
24
24
  id: number;
25
25
  } | null;
26
- app: {
27
- id: number;
28
- slug?: string;
29
- node_id: string;
30
- owner: {
31
- name?: string | null;
32
- email?: string | null;
33
- login: string;
34
- id: number;
35
- node_id: string;
36
- avatar_url: string;
37
- gravatar_id: string | null;
38
- url: string;
39
- html_url: string;
40
- followers_url: string;
41
- following_url: string;
42
- gists_url: string;
43
- starred_url: string;
44
- subscriptions_url: string;
45
- organizations_url: string;
46
- repos_url: string;
47
- events_url: string;
48
- received_events_url: string;
49
- type: string;
50
- site_admin: boolean;
51
- starred_at?: string;
52
- } | null;
53
- name: string;
54
- description: string | null;
55
- external_url: string;
56
- html_url: string;
57
- created_at: string;
58
- updated_at: string;
59
- permissions: {
60
- issues?: string;
61
- checks?: string;
62
- metadata?: string;
63
- contents?: string;
64
- deployments?: string;
65
- [key: string]: string | undefined;
66
- };
67
- events: string[];
68
- installations_count?: number;
69
- client_id?: string;
70
- client_secret?: string;
71
- webhook_secret?: string | null;
72
- pem?: string;
73
- } | null;
74
- pull_requests: {
75
- id: number;
76
- number: number;
77
- url: string;
78
- head: {
79
- ref: string;
80
- sha: string;
81
- repo: {
82
- id: number;
83
- url: string;
84
- name: string;
85
- };
86
- };
87
- base: {
88
- ref: string;
89
- sha: string;
90
- repo: {
91
- id: number;
92
- url: string;
93
- name: string;
94
- };
95
- };
96
- }[];
97
- deployment?: {
98
- url: string;
99
- id: number;
100
- node_id: string;
101
- task: string;
102
- original_environment?: string;
103
- environment: string;
104
- description: string | null;
105
- created_at: string;
106
- updated_at: string;
107
- statuses_url: string;
108
- repository_url: string;
109
- transient_environment?: boolean;
110
- production_environment?: boolean;
111
- performed_via_github_app?: {
112
- id: number;
113
- slug?: string;
114
- node_id: string;
115
- owner: {
116
- name?: string | null;
117
- email?: string | null;
118
- login: string;
119
- id: number;
120
- node_id: string;
121
- avatar_url: string;
122
- gravatar_id: string | null;
123
- url: string;
124
- html_url: string;
125
- followers_url: string;
126
- following_url: string;
127
- gists_url: string;
128
- starred_url: string;
129
- subscriptions_url: string;
130
- organizations_url: string;
131
- repos_url: string;
132
- events_url: string;
133
- received_events_url: string;
134
- type: string;
135
- site_admin: boolean;
136
- starred_at?: string;
137
- } | null;
138
- name: string;
139
- description: string | null;
140
- external_url: string;
141
- html_url: string;
142
- created_at: string;
143
- updated_at: string;
144
- permissions: {
145
- issues?: string;
146
- checks?: string;
147
- metadata?: string;
148
- contents?: string;
149
- deployments?: string;
150
- [key: string]: string | undefined;
151
- };
152
- events: string[];
153
- installations_count?: number;
154
- client_id?: string;
155
- client_secret?: string;
156
- webhook_secret?: string | null;
157
- pem?: string;
158
- } | null;
159
- };
26
+ app: import("@octokit/openapi-types").components["schemas"]["nullable-integration"];
27
+ pull_requests: import("@octokit/openapi-types").components["schemas"]["pull-request-minimal"][];
28
+ deployment?: import("@octokit/openapi-types").components["schemas"]["deployment-simple"];
160
29
  }[]>;
@@ -1,22 +1,8 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getCheckRuns = getCheckRuns;
13
- function getCheckRuns(owner, repo, ref, octokit) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- const response = yield octokit.rest.checks.listForRef({
16
- owner,
17
- repo,
18
- ref,
19
- });
20
- return response.data.check_runs;
1
+ export async function getCheckRuns(owner, repo, ref, octokit) {
2
+ const response = await octokit.rest.checks.listForRef({
3
+ owner,
4
+ repo,
5
+ ref,
21
6
  });
7
+ return response.data.check_runs;
22
8
  }
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMergeMethod = getMergeMethod;
4
- const core_1 = require("@actions/core");
5
- function getMergeMethod() {
6
- const mergeMethod = (0, core_1.getInput)('merge-method');
1
+ import { getInput } from '@actions/core';
2
+ export function getMergeMethod() {
3
+ const mergeMethod = getInput('merge-method');
7
4
  if (mergeMethod !== 'merge' &&
8
5
  mergeMethod !== 'squash' &&
9
6
  mergeMethod !== 'rebase') {
@@ -1,6 +1,6 @@
1
- import { type Octokit } from '@octokit/core/dist-types/index.js';
2
- import { type PaginateInterface } from '@octokit/plugin-paginate-rest';
3
- import { type Api } from '@octokit/plugin-rest-endpoint-methods/dist-types/types.js';
1
+ import type { Octokit } from '@octokit/core';
2
+ import type { PaginateInterface } from '@octokit/plugin-paginate-rest';
3
+ import type { Api } from '@octokit/plugin-rest-endpoint-methods';
4
4
  export declare function getOctokit(githubToken: string): Octokit & Api & {
5
5
  paginate: PaginateInterface;
6
6
  };
@@ -1,37 +1,33 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOctokit = getOctokit;
4
- const core_1 = require("@actions/core");
5
- const utils_js_1 = require("@actions/github/lib/utils.js");
6
- const plugin_retry_1 = require("@octokit/plugin-retry");
7
- const plugin_throttling_1 = require("@octokit/plugin-throttling");
8
- function getOctokit(githubToken) {
9
- const Octokit = utils_js_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_retry_1.retry);
10
- const octokit = new Octokit((0, utils_js_1.getOctokitOptions)(githubToken, {
1
+ import { GitHub, getOctokitOptions } from '@actions/github/lib/utils';
2
+ import { retry } from '@octokit/plugin-retry';
3
+ import { throttling } from '@octokit/plugin-throttling';
4
+ export function getOctokit(githubToken) {
5
+ const Octokit = GitHub.plugin(throttling, retry);
6
+ const octokit = new Octokit(getOctokitOptions(githubToken, {
11
7
  throttle: {
12
8
  onRateLimit: (retryAfter, options, _, retryCount) => {
13
9
  if (retryCount === 0) {
14
- (0, core_1.warning)(`Request quota exhausted for request ${options.method} ${options.url}`);
15
- (0, core_1.info)(`Retrying after ${retryAfter} seconds!`);
10
+ octokit.log.warn(`Request quota exhausted for request ${options.method} ${options.url}`);
11
+ octokit.log.info(`Retrying after ${retryAfter} seconds!`);
16
12
  return true;
17
13
  }
18
14
  else {
19
- (0, core_1.error)(`Request quota exhausted for request ${options.method} ${options.url}`);
15
+ octokit.log.error(`Request quota exhausted for request ${options.method} ${options.url}`);
20
16
  }
21
17
  },
22
18
  onSecondaryRateLimit: (retryAfter, options, _, retryCount) => {
23
19
  if (retryCount === 0) {
24
- (0, core_1.warning)(`Abuse detected for request ${options.method} ${options.url}`);
25
- (0, core_1.info)(`Retrying after ${retryAfter} seconds!`);
20
+ octokit.log.warn(`Abuse detected for request ${options.method} ${options.url}`);
21
+ octokit.log.info(`Retrying after ${retryAfter} seconds!`);
26
22
  return true;
27
23
  }
28
24
  else {
29
- (0, core_1.warning)(`Abuse detected for request ${options.method} ${options.url}`);
25
+ octokit.log.warn(`Abuse detected for request ${options.method} ${options.url}`);
30
26
  }
31
27
  },
32
28
  },
33
29
  retry: {
34
- doNotRetry: ['403', '429'],
30
+ doNotRetry: ['429'],
35
31
  },
36
32
  }));
37
33
  octokit.graphql = octokit.graphql.defaults({
@@ -1,4 +1,3 @@
1
1
  import type { Octokit } from '@octokit/core';
2
- import type { Api } from '@octokit/plugin-rest-endpoint-methods/dist-types/types';
3
- import type { PullRequest } from '@octokit/webhooks-types/schema';
4
- export declare function getPullRequest(owner: string, repo: string, pullRequestNumber: number, octokit: Octokit & Api): Promise<PullRequest>;
2
+ import type { Api, RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';
3
+ export declare function getPullRequest(owner: string, repo: string, pullRequestNumber: number, octokit: Octokit & Api): Promise<RestEndpointMethodTypes['pulls']['get']['response']['data']>;
@@ -1,22 +1,8 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getPullRequest = getPullRequest;
13
- function getPullRequest(owner, repo, pullRequestNumber, octokit) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- const response = yield octokit.rest.pulls.get({
16
- owner,
17
- repo,
18
- pull_number: pullRequestNumber,
19
- });
20
- return response.data;
1
+ export async function getPullRequest(owner, repo, pullRequestNumber, octokit) {
2
+ const response = await octokit.rest.pulls.get({
3
+ owner,
4
+ repo,
5
+ pull_number: pullRequestNumber,
21
6
  });
7
+ return response.data;
22
8
  }
@@ -1,7 +1,6 @@
1
1
  import type { Octokit } from '@octokit/core';
2
- import type { Api } from '@octokit/plugin-rest-endpoint-methods/dist-types/types';
3
- import { PullRequest } from '@octokit/webhooks-types/schema';
4
- export declare function getPullRequestAutoMergeable(owner: string, repo: string, pullRequest: PullRequest, octokit: Octokit & Api): Promise<{
2
+ import type { Api, RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';
3
+ export declare function getPullRequestAutoMergeable(owner: string, repo: string, pullRequest: RestEndpointMethodTypes['pulls']['get']['response']['data'], octokit: Octokit & Api): Promise<{
5
4
  pullRequestId: string;
6
5
  viewerCanEnableAutoMerge: boolean;
7
6
  }>;
@@ -1,19 +1,6 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getPullRequestAutoMergeable = getPullRequestAutoMergeable;
13
- function getPullRequestAutoMergeable(owner, repo, pullRequest, octokit) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- const pullRequestNumber = pullRequest.number;
16
- const { repository: { pullRequest: { pullRequestId, viewerCanEnableAutoMerge }, }, } = yield octokit.graphql(`
1
+ export async function getPullRequestAutoMergeable(owner, repo, pullRequest, octokit) {
2
+ const pullRequestNumber = pullRequest.number;
3
+ const { repository: { pullRequest: { pullRequestId, viewerCanEnableAutoMerge }, }, } = await octokit.graphql(`
17
4
  query($owner: String!, $repo: String!, $pullRequestNumber: Int!) {
18
5
  repository(owner: $owner, name: $repo) {
19
6
  pullRequest(number: $pullRequestNumber) {
@@ -23,13 +10,12 @@ function getPullRequestAutoMergeable(owner, repo, pullRequest, octokit) {
23
10
  }
24
11
  }
25
12
  `, {
26
- owner,
27
- repo,
28
- pullRequestNumber,
29
- });
30
- return {
31
- pullRequestId,
32
- viewerCanEnableAutoMerge,
33
- };
13
+ owner,
14
+ repo,
15
+ pullRequestNumber,
34
16
  });
17
+ return {
18
+ pullRequestId,
19
+ viewerCanEnableAutoMerge,
20
+ };
35
21
  }
@@ -1,6 +1,6 @@
1
1
  import type { Octokit } from '@octokit/core';
2
- import type { components } from '@octokit/openapi-types/types';
3
- import type { Api } from '@octokit/plugin-rest-endpoint-methods/dist-types/types';
2
+ import type { components } from '@octokit/openapi-types';
3
+ import type { Api } from '@octokit/plugin-rest-endpoint-methods';
4
4
  export declare function getPullRequestComments(owner: string, repo: string, pullRequestNumber: number, octokit: Octokit & Api): Promise<{
5
5
  url: string;
6
6
  pull_request_review_id: number | null;
@@ -34,4 +34,5 @@ export declare function getPullRequestComments(owner: string, repo: string, pull
34
34
  original_line?: number;
35
35
  start_line?: number | null;
36
36
  original_start_line?: number | null;
37
+ subject_type?: "line" | "file";
37
38
  }[]>;
@@ -1,22 +1,8 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getPullRequestComments = getPullRequestComments;
13
- function getPullRequestComments(owner, repo, pullRequestNumber, octokit) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- const response = yield octokit.rest.pulls.listReviewComments({
16
- owner,
17
- repo,
18
- pull_number: pullRequestNumber,
19
- });
20
- return response.data;
1
+ export async function getPullRequestComments(owner, repo, pullRequestNumber, octokit) {
2
+ const response = await octokit.rest.pulls.listReviewComments({
3
+ owner,
4
+ repo,
5
+ pull_number: pullRequestNumber,
21
6
  });
7
+ return response.data;
22
8
  }