Khan / pull-request-comment-trigger

A github action for detecting a "trigger" in a pull request description or comment
207 stars 91 forks source link

Prefix_only doesn't work #18

Open GabrieleCalarota opened 2 years ago

GabrieleCalarota commented 2 years ago

Hi,

I'm encountering this issue using this action khan/pull-request-comment-trigger@master using:

        - uses: khan/pull-request-comment-trigger@master
          id: check
          with:
            trigger: '!deploy'
            prefix_only: 'true'
            reaction: rocket
          env:
            GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'

Action gets triggered also if "!deploy" is in the middle of a comment (not according to README.md docs)

Also --> trying to get steps.check.outputs.comment_body is empty

GabrieleCalarota commented 2 years ago

This line of code should be like this:

    const prefixOnly = core.getInput("prefix_only") === 'true';
    if ((prefixOnly && !body.startsWith(trigger)) || (!prefixOnly && !body.includes(trigger))) {
        core.setOutput("triggered", "false");
        return;
    }
GabrieleCalarota commented 2 years ago

Any update on this @jaredly ?