Skip to content

Instantly share code, notes, and snippets.

@cozzin
Created May 23, 2022 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cozzin/b9b8354d1bccb48e238112e2523c3d1f to your computer and use it in GitHub Desktop.
Save cozzin/b9b8354d1bccb48e238112e2523c3d1f to your computer and use it in GitHub Desktop.
pr comment bot
name: Pull request comment
on:
issue_comment:
types: [created, edited, deleted]
jobs:
pull_request_comment:
if: contains(github.event.comment.html_url, '/pull/') # check if the comments come from pull request, exclude those from issue.
runs-on: [macos-latest]
steps:
- name: Deploy
if: contains(github.event.comment.body, '/deploy') # check the comment if it contains the keywords
run: |
echo start deploy
- name: Add deploy comment # https://stackoverflow.com/questions/58066966/commenting-a-pull-request-in-a-github-action
if: contains(github.event.comment.body, '/deploy') # check the comment if it contains the keywords
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🚀'
})
- name: Test
if: contains(github.event.comment.body, '/test') # check the comment if it contains the keywords
run: |
echo start test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment