Phrase triggering of workflows in pull requests

Hi,

I’m trying to duplicate behaviour of Jenkins ghprb plugin, which allows you to start a Jenkins job by posting a trigger phrase in a pull request comment.

I think that the closest event to use in Actions would be 

pull_request_review_comment

but I didn’t manage to use it so far.

Does anyone know how to do that?

Cheers!

2 Likes

I have the same issue.

I’m creating actions these days.

https://github.com/tyankatsu0105/message-to-slack-from-github/pull/1

But I can’t find a solution to the trigger for PR comment. 

I found this page. https://developer.github.com/v3/guides/working-with-comments/#pull-request-comments

According to this page, PR comments use issues API.

I tried adding issue_comment on on.

But not working…

OK.

I understand.

PR message’s eventName is issue_comment.

So you can check Mention Slack jobs’s log in here.

https://github.com/tyankatsu0105/message-to-slack-from-github/commit/9a72de4917a22696b0ece5cd6ca9c11cfc2d21c8/checks?check_suite_id=334701535

Having the same issue.  I’ve created a small workflow that just prints the comment but it never fires when I comment on the pull request containing this workflow.  Even tried covering all the bases for the different events but no joy.

Do we somehow have to register the workflow to fire on PR comments some other way?

name: terraform-staging-apply

on:
  issue_comment:
    types: [created, edited]
  pull_request_review_comment:
    types: [created, edited]
  pull_request_review:
    types: [submitted, edited, dismissed]
  issues:
    types: [opened, closed]

jobs:
  terraform-apply:
    name: Terraform Apply
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@1.0.0
        with:
          submodules: 'true'
          token: ${{ secrets.PAT }} # Needed for private submodules

      - uses: actions/github-script@0.2.0
        with:
          github-token: ${{github.token}}
          script: |
            const body = context.payload.pull_request.body.toLowerCase()
            console.log("Detected comment: " + body)

Found the issue in another thread:

https://github.community/t5/GitHub-Actions/on-issue-comment-events-are-not-triggering-workflows/m-p/37177

In short, the workflow triggering on issue comments MUST be in master

1 Like