# This workflow is centrally managed in https://github.com/asyncapi/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo

name: Create help comment

on: 
    issue_comment:
        types: 
            - created

jobs:
  create_help_comment_pr:
    if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions-ecosystem/action-create-comment@v1
        with:
          github_token: ${{ secrets.GH_TOKEN }}
          body: |
            Hello, @${{ github.actor }}! 👋🏼 

            I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘 

            At the moment the following comments are supported in pull requests:

            - `/ready-to-merge` or `/rtm` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
            - `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
            - `/autoupdate` or `/au` - This comment will add `autoupdate` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict.
  create_help_comment_issue:
    if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions-ecosystem/action-create-comment@v1
        with:
          github_token: ${{ secrets.GH_TOKEN }}
          body: |
            Hello, @${{ github.actor }}! 👋🏼 

            I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘 

            At the moment the following comments are supported in issues:

            - `/good-first-issue {js | ts | java | go | docs | design | ci-cd} ` or `/gfi {js | ts | java | go | docs | design | ci-cd} ` - label an issue as a `good first issue`.
            example: `/gfi js` or `/good-first-issue ci-cd`
