diff --git a/.gitignore b/.gitignore index 3c3629e..cd98105 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +.idea/ \ No newline at end of file diff --git a/action.yml b/action.yml index 9bb1da1..53c0628 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,4 @@ -name: 'Pull Request Comment Trigger' +name: 'Pull Request Comment Trigger v1.0.1' description: 'Look for a "trigger word" in a pull-request description or comment, so that later steps can know whether or not to run.' inputs: reaction: @@ -22,4 +22,4 @@ runs: main: 'dist/index.js' branding: icon: check-circle - color: red \ No newline at end of file + color: red diff --git a/index.js b/index.js index cb3a281..14a4248 100755 --- a/index.js +++ b/index.js @@ -13,12 +13,6 @@ async function run() { return; } - const body = - context.eventName === "issue_comment" - ? context.payload.comment.body - : context.payload.pull_request.body; - core.setOutput('comment_body', body); - if ( context.eventName === "issue_comment" && !context.payload.issue.pull_request @@ -27,16 +21,21 @@ async function run() { core.setOutput("triggered", "false"); return; } + console.log(context.payload); + const body = context.payload.issue.body; + + console.log(body); + core.setOutput('comment_body', body); const { owner, repo } = context.repo; const prefixOnly = core.getInput("prefix_only") === 'true'; - if ((prefixOnly && !body.startsWith(trigger)) || !body.includes(trigger)) { + if ((prefixOnly && !body.startsWith(trigger)) || (!prefixOnly && !body.includes(trigger))) { core.setOutput("triggered", "false"); return; } - + console.log(trigger); core.setOutput("triggered", "true"); if (!reaction) {