Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comvent ⚡️ Playground 🏞 #24

Open
rytswd opened this issue Jan 8, 2021 · 60 comments
Open

Comvent ⚡️ Playground 🏞 #24

rytswd opened this issue Jan 8, 2021 · 60 comments

Comments

@rytswd
Copy link
Owner

rytswd commented Jan 8, 2021

😎 TL; DR

Comment to this issue with the following one line (no need to wrap in backticks):

/hello-world

You will see an automated comment response in 1 min or so!

🔎 About

This is only a playground 🏞
You can comment on this to see Comvent in action, which uses https://github.com/actions/github-script.

Multiple commands can be issued at once in a single comment, as long as they are provided in separate lines.

📝 Note

Because GitHub Action takes several seconds to initiate the action, you may see up to 1 min delay.

💻 Available Commands

For all users

  • /weather: automation responds with a comment
  • /hello-world: automation responds with a comment
  • /echo (.+)$: automation responds with your comment in (.+) portion of regexp

Ref: https://github.com/rytswd/comvent/blob/main/.github/workflows/issue-comment-blacklist-demo.yaml

For specific users (currently set for only @rytswd)

  • /random: automation responds with a comment
  • /today: automation responds with a comment
  • /httpbin: automation responds with a comment

Ref: https://github.com/rytswd/comvent/blob/main/.github/workflows/issue-comment-whitelist-demo.yaml

Abuse Monitor

  • some abusive content: If you write a comment including this exact phrase in a single line, you will see the comment being removed via the automation. You will also see a comment about the comment deletion.

Ref: https://github.com/rytswd/comvent/blob/main/.github/workflows/abusive-comment-demo.yaml

@rytswd
Copy link
Owner Author

rytswd commented Jan 8, 2021

/hello-world
/random

@github-actions
Copy link

github-actions bot commented Jan 8, 2021

Command /hello-world was triggered by the comment

@github-actions
Copy link

github-actions bot commented Jan 8, 2021

Command /random was triggered by the comment

@github-actions
Copy link

github-actions bot commented Jan 8, 2021

Found abusive comment! 😰
The comment was thus removed.

@github-actions github-actions bot deleted a comment from rytswd Jan 8, 2021
@lgmorand
Copy link

lgmorand commented Feb 21, 2021

/random

@rytswd
Copy link
Owner Author

rytswd commented Feb 21, 2021

Thanks for checking out, and it does look like something is not functioning correctly when comment is edited, perhaps... 😥
I'll check more into this in the coming days, and will get back to the thread.

For now, this is another test.

/random

After edit:

/hello-world

/random

@github-actions
Copy link

Command /random was triggered by the comment

@github-actions
Copy link

Command /hello-world was triggered by the comment

@github-actions
Copy link

Command /random was triggered by the comment

@rytswd
Copy link
Owner Author

rytswd commented Feb 24, 2021

Hi @lgmorand - I think your earlier attempt didn't match the comvent setup, because you were triggering the command for "specific" user setup, which is triggered only for whitelisted user list (in this case it only has myself @rytswd listed).

If you instead trigger with comment such as /weather or /hello-world, it should work and you get some automation in action!

@lgmorand
Copy link

maybe TLDR; :D I just copy-pasted your precedent comment

@lgmorand
Copy link

/hello-world

@github-actions
Copy link

Command /hello-world was triggered by the comment

@rytswd
Copy link
Owner Author

rytswd commented Feb 24, 2021

Thanks! It's a good point, I added a TL;DR section 😆

@rytswd

This comment has been minimized.

@github-actions

This comment has been minimized.

@rytswd
Copy link
Owner Author

rytswd commented Apr 19, 2021

/echo this is a test message

@github-actions
Copy link

Command /echo was triggered by the comment. You echoed "this is a test message".

@rytswd
Copy link
Owner Author

rytswd commented Apr 21, 2021

/echo this is test, it may fail due to the job condition.

@rytswd
Copy link
Owner Author

rytswd commented Apr 21, 2021

/echo this is another test.

There was an error with the job condition.

@github-actions
Copy link

Command /echo was triggered by the comment. You echoed "".

@rytswd
Copy link
Owner Author

rytswd commented Apr 21, 2021

/echo this is another test, this time the response will look up the string correctly.

@github-actions
Copy link

Command /echo was triggered by the comment. You echoed "this is another test, this time the response will look up the string correctly.".

@iam-py-test
Copy link

/random

@iam-py-test
Copy link

/echo test

@github-actions
Copy link

github-actions bot commented Jun 1, 2021

Command /echo was triggered by the comment. You echoed "test".

@iam-py-test
Copy link

/hello-world

@github-actions
Copy link

github-actions bot commented Jun 1, 2021

Command /hello-world was triggered by the comment

@github-actions
Copy link

github-actions bot commented Jun 1, 2021

Found abusive comment! 😰
The comment was thus removed.

@iam-py-test
Copy link

@iam-py-test
Do you mean to put the username along with the comment from github-actions above?
If so, you can write the original comment sender by ${{ github.event.sender.login }} as a part of GitHub Action step. This is something that GitHub provides, which you can find more in https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#issue_comment 👍

Comvent itself does not keep hold of the username in its output. If there is a use case for that, it would be great if you can provide more details and background in a separate issue, so that it can be considered for future enhancements ☺️

Ok, thanks

@iam-py-test
Copy link

Please forgive me for not knowing, but does anyone know how to install this?
I tried the instructions & it did not work.
Thanks!

@rytswd
Copy link
Owner Author

rytswd commented Jun 8, 2021

@iam-py-test
Sorry for the delayed response, what sort of error did you get from the instruction? (and which instruction did you follow?)

The installation should be straightforward GitHub Action usage, something like:

jobs:
  chatbot:
    name: ChatBot
    runs-on: ubuntu-latest

    steps:
      - name: Handle with Comvent
        uses: rytswd/[email protected] # Latest available as of now
        id: comvent
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          config-path: .github/comvent-chatbot.yaml # Assumes this file exists

If you could provide a bit more detail, I should be able to assist you further 👍

@iam-py-test
Copy link

@iam-py-test
Sorry for the delayed response, what sort of error did you get from the instruction? (and which instruction did you follow?)

The installation should be straightforward GitHub Action usage, something like:

jobs:
  chatbot:
    name: ChatBot
    runs-on: ubuntu-latest

    steps:
      - name: Handle with Comvent
        uses: rytswd/[email protected] # Latest available as of now
        id: comvent
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          config-path: .github/comvent-chatbot.yaml # Assumes this file exists

If you could provide a bit more detail, I should be able to assist you further 👍

Ok! @rytswd Thanks! I think I just misunderstood something!

@iam-py-test
Copy link

iam-py-test commented Jun 8, 2021

@rytswd When I tried it, I got this error:
image
Repo: https://github.com/iam-py-test/my_filters_001
Sorry I did not respond earlier; I was busy.

@iam-py-test
Copy link

/weather

@github-actions
Copy link

github-actions bot commented Jun 8, 2021

Command /weather was triggered by the comment

@iam-py-test
Copy link

Command /weather was triggered by the comment

test

@iam-py-test
Copy link

/weather

@rytswd
Copy link
Owner Author

rytswd commented Jun 8, 2021

If you are referring to getting an error with https://github.com/iam-py-test/my_filters_001/blob/main/.github/workflows/comment.yml, it doesn't look to conform to GitHub Actions requirements (i.e. missing on stanza, etc.). I'd suggest checking out GitHub Actions documentation for the actual spec.

If you want to simply get the same result as this repo's example, I suggest you check out the setup here
https://github.com/rytswd/comvent/blob/main/.github/workflows/issue-comment-blacklist-demo.yaml

@iam-py-test
Copy link

If you are referring to getting an error with https://github.com/iam-py-test/my_filters_001/blob/main/.github/workflows/comment.yml, it doesn't look to conform to GitHub Actions requirements (i.e. missing on stanza, etc.). I'd suggest checking out GitHub Actions documentation for the actual spec.

If you want to simply get the same result as this repo's example, I suggest you check out the setup here
https://github.com/rytswd/comvent/blob/main/.github/workflows/issue-comment-blacklist-demo.yaml

Ok! Will do.
Thank you for your help

@iam-py-test
Copy link

iam-py-test commented Jun 8, 2021

I tried that and I get this error:
image

I copy-pasted everything from this repo.

Please forgive me for my errors as I am new to GitHub actions
Thanks for your help

@rytswd
Copy link
Owner Author

rytswd commented Jun 8, 2021

Apologies, I should have been clearer - you cannot copy directly from the aforementioned file, as this repo does not pull in the GitHub Action spec but builds itself in the action setup. You need to combine the file content with the setup mentioned here:
#24 (comment)

You can see a complete example here https://github.com/rytswd/comvent#chatbot-setup, by clicking on Click to view full example. (Note that this refers to v0.3)

name: ChatBot
on:
  issue_comment:
    # This shouldn't be called for comment deletion
    types:
      - created
      - edited

jobs:
  chatbot:
    name: With latest code base
    runs-on: ubuntu-latest

    steps:
      - name: Handle with Comvent
        uses: rytswd/[email protected]
        id: comvent
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          config-path: .github/comvent-chatbot.yaml

      # The below only runs when Comvent finds matching comment.
      # This assumes that Comvent config holding 'command-random' as a keyword.
      - if: steps.comvent.outputs.command-random != ''
        name: Handle random event
        uses: actions/github-script@v3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          # An example of responding to a comment.
          script: |
            const comment = `Command \`/random\` was triggered by the comment`;

            github.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: comment
            })

      #
      # You can repeat similar handling based on the Comvent config.
      #

@iam-py-test
Copy link

Apologies, I should have been clearer - you cannot copy directly from the aforementioned file, as this repo does not pull in the GitHub Action spec but builds itself in the action setup. You need to combine the file content with the setup mentioned here:
#24 (comment)

You can see a complete example here https://github.com/rytswd/comvent#chatbot-setup, by clicking on Click to view full example. (Note that this refers to v0.3)

name: ChatBot
on:
  issue_comment:
    # This shouldn't be called for comment deletion
    types:
      - created
      - edited

jobs:
  chatbot:
    name: With latest code base
    runs-on: ubuntu-latest

    steps:
      - name: Handle with Comvent
        uses: rytswd/[email protected]
        id: comvent
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          config-path: .github/comvent-chatbot.yaml

      # The below only runs when Comvent finds matching comment.
      # This assumes that Comvent config holding 'command-random' as a keyword.
      - if: steps.comvent.outputs.command-random != ''
        name: Handle random event
        uses: actions/github-script@v3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          # An example of responding to a comment.
          script: |
            const comment = `Command \`/random\` was triggered by the comment`;

            github.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: comment
            })

      #
      # You can repeat similar handling based on the Comvent config.
      #

@rytswd Thank you!

@iam-py-test
Copy link

I tried it & it worked! Thanks @rytswd

@rytswd rytswd pinned this issue Aug 4, 2021
@abhimanyuseth-alation
Copy link

/echo run this test

@github-actions
Copy link

Command /echo was triggered by the comment. You echoed "run this test".

@RupertBarrow
Copy link

/hello-world

@github-actions
Copy link

github-actions bot commented Dec 3, 2021

Command /hello-world was triggered by the comment

@iam-py-test
Copy link

/echo bold test

@github-actions
Copy link

github-actions bot commented Dec 3, 2021

Command /echo was triggered by the comment. You echoed "bold test".

@iam-py-test
Copy link

/echo **bold** <-- can’t see me--> #1

@scratchmex
Copy link

/echo it works?

@github-actions
Copy link

Command /echo was triggered by the comment. You echoed "it works?".

@Paragramex
Copy link

/help

@github-actions
Copy link

github-actions bot commented Nov 8, 2022

Found abusive comment! 😰
The comment was thus removed.

@github-actions github-actions bot deleted a comment from Paragramex Nov 8, 2022
@Paragramex
Copy link

rip

@github-actions
Copy link

github-actions bot commented Nov 8, 2022

Command /echo was triggered by the comment. You echoed "some abusive content".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants