Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fixing prefix only #19

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -22,4 +22,4 @@ runs:
main: 'dist/index.js'
branding:
icon: check-circle
color: red
color: red
15 changes: 7 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment on lines -16 to -20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this removed?


if (
context.eventName === "issue_comment" &&
!context.payload.issue.pull_request
Expand All @@ -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);
Comment on lines +24 to +27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the logging necessary?

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 (!body.includes(trigger) || (prefixOnly && !body.startsWith(trigger)) ) {
GabrieleCalarota marked this conversation as resolved.
Show resolved Hide resolved
core.setOutput("triggered", "false");
return;
}

console.log(trigger);
core.setOutput("triggered", "true");

if (!reaction) {
Expand Down