Skip to content

Commit

Permalink
Only run action on pull_request event (Fixes #8)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewiggins committed Jul 28, 2020
1 parent c4e53fb commit bf099f5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ async function createCheck(github, context) {
const inputs = getInputs(logger);
const octokit = util.github.getOctokit(token);

if (util.github.context.eventName !== "pull_request") {
logger.info(
"Not a pull request event. Skipping this action and doing nothing."
);
logger.info("Event name: " + util.github.context.eventName);
return;
}

let finish;
if (useCheck == "true") {
finish = await createCheck(octokit, util.github.context);
Expand Down
6 changes: 6 additions & 0 deletions dist/pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ const { getLogger, getInputs } = util.util;
'No reportId provided. Skipping updating comment with "Running..." status.'
);

return;
} else if (context.eventName !== "pull_request") {
logger.info(
"Not a pull request event. Skipping this action and doing nothing."
);
logger.info("Event name: " + util.github.context.eventName);
return;
}

Expand Down
8 changes: 8 additions & 0 deletions src/actions/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ async function createCheck(github, context) {
const inputs = getInputs(logger);
const octokit = github.getOctokit(token);

if (github.context.eventName !== "pull_request") {
logger.info(
"Not a pull request event. Skipping this action and doing nothing."
);
logger.info("Event name: " + github.context.eventName);
return;
}

let finish;
if (useCheck == "true") {
finish = await createCheck(octokit, github.context);
Expand Down
6 changes: 6 additions & 0 deletions src/actions/pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const { getLogger, getInputs } = require("./util");
'No reportId provided. Skipping updating comment with "Running..." status.'
);

return;
} else if (context.eventName !== "pull_request") {
logger.info(
"Not a pull request event. Skipping this action and doing nothing."
);
logger.info("Event name: " + github.context.eventName);
return;
}

Expand Down

0 comments on commit bf099f5

Please sign in to comment.