Skip to content

Commit

Permalink
Move logic till when needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
lasseborly committed Dec 6, 2021
1 parent bcf130f commit 0de0e00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8321,19 +8321,19 @@ function run() {
const shouldRun = (comment === null || comment === void 0 ? void 0 : comment.body) === approveCommand;
if (!shouldRun)
return;
const octokit = github.getOctokit(token);
const repository = payload.repository;
if (!repository) {
core.setFailed("Could not find repository.");
return;
}
const repo = repository.name;
const owner = repository.owner.login;
const pull_number = (_a = payload.issue) === null || _a === void 0 ? void 0 : _a.number;
if (!pull_number) {
core.setFailed("Could not find issue/pull request.");
return;
}
const repo = repository.name;
const owner = repository.owner.login;
const octokit = github.getOctokit(token);
const pull = yield octokit.rest.pulls.get({
owner,
repo,
Expand Down
9 changes: 5 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,25 @@ async function run() {
const shouldRun = comment?.body === approveCommand;
if (!shouldRun) return;

const octokit = github.getOctokit(token);

const repository = payload.repository;

if (!repository) {
core.setFailed("Could not find repository.");
return;
}

const repo = repository.name;
const owner = repository.owner.login;
const pull_number = payload.issue?.number;

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

const repo = repository.name;
const owner = repository.owner.login;

const octokit = github.getOctokit(token);

const pull = await octokit.rest.pulls.get({
owner,
repo,
Expand Down

0 comments on commit 0de0e00

Please sign in to comment.