Triggering workflow only for Pull Request Comment


Is there  a way in triggering the workflow only for the Pull Request Comments  and not for the issue comment ?. 
I am aware that on  issue_comment  will trigger the workflow for both pull request comment as well as issue comment, But I don’t want to trigger the workflow at all for issue comments.

It will be great If anyone can help me out on this. 

1 Like

Currently, there is not any easy way to set filter on Issue comment event to let workflow be triggered only when comment on PR or only on issue.

However, from the github context for the event, I found some different between issue and PR.

  • If comment on PR triggers the workflow, the value of event.comment.html_url is:<org>/<repo>/pull/<pr_id>#issuecomment-<comment_id>

  • If comment on issue triggers the workflow, the value of event.comment.html_url is:<org>/<repo>/issues/<issue_id>#issuecomment-<comment_id>

So you can try the below if conditional to skip all the jobs when the workflow is triggered by comment on issue.

    if: contains(github.event.comment.html_url, '/pull/')
1 Like

Thank you very much. It certainly helped. However, Filtering with jobs are failing and I am not able to see the runner logs too. Could you please check this issue ?