Skip to content

Trigger a github workflow if it matches a particular comment in the Pull Request #25389

Answered by weide-zhou
uditgaurav asked this question in Actions
Discussion options

You must be logged in to vote

Hi @uditgaurav,

There is not a specific event which only monitor the pull request event, you can use ‘issue_comment’ instead, it will monitor comment for both issue and pull request. In the job level, use if expression to filter the comment, exclude the comments from issue.
Code sample as below:

name: pull request comment
on:
  issue_comment:                                     
    types: [created, edited, deleted]

jobs:
job01:
if: contains(github.event.comment.html_url, '/pull/') # check if the comments come from pull request, exclude those from issue.
runs-on: [ubuntu-latest]
steps:
- name: say hello
if: contains(github.event.comment.body, '/support') # check the comment if it con…

Replies: 6 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@JackelynOliveira
Comment options

Answer selected
Comment options

You must be logged in to vote
2 replies
@SanMantri
Comment options

@tarekbeb
Comment options

Comment options

You must be logged in to vote
0 replies

This comment was marked as off-topic.

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Product Feedback
9 participants