Skip to content

Commit 0de0e00

Browse files
committed
Move logic till when needed.
1 parent bcf130f commit 0de0e00

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

dist/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8321,19 +8321,19 @@ function run() {
83218321
const shouldRun = (comment === null || comment === void 0 ? void 0 : comment.body) === approveCommand;
83228322
if (!shouldRun)
83238323
return;
8324-
const octokit = github.getOctokit(token);
83258324
const repository = payload.repository;
83268325
if (!repository) {
83278326
core.setFailed("Could not find repository.");
83288327
return;
83298328
}
8330-
const repo = repository.name;
8331-
const owner = repository.owner.login;
83328329
const pull_number = (_a = payload.issue) === null || _a === void 0 ? void 0 : _a.number;
83338330
if (!pull_number) {
83348331
core.setFailed("Could not find issue/pull request.");
83358332
return;
83368333
}
8334+
const repo = repository.name;
8335+
const owner = repository.owner.login;
8336+
const octokit = github.getOctokit(token);
83378337
const pull = yield octokit.rest.pulls.get({
83388338
owner,
83398339
repo,

src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,25 @@ async function run() {
1212
const shouldRun = comment?.body === approveCommand;
1313
if (!shouldRun) return;
1414

15-
const octokit = github.getOctokit(token);
16-
1715
const repository = payload.repository;
1816

1917
if (!repository) {
2018
core.setFailed("Could not find repository.");
2119
return;
2220
}
2321

24-
const repo = repository.name;
25-
const owner = repository.owner.login;
2622
const pull_number = payload.issue?.number;
2723

2824
if (!pull_number) {
2925
core.setFailed("Could not find issue/pull request.");
3026
return;
3127
}
3228

29+
const repo = repository.name;
30+
const owner = repository.owner.login;
31+
32+
const octokit = github.getOctokit(token);
33+
3334
const pull = await octokit.rest.pulls.get({
3435
owner,
3536
repo,

0 commit comments

Comments
 (0)