Coder Social home page Coder Social logo

commentagent's Introduction

CommentAgent

A GitHub bot to trigger a configured GitHub action based on found text in a comment from an authorized user. Built with probot and glitch.

Current version: 1.0.0

Marketplace link: https://github.com/marketplace/CommentAgent

Installation

After installation, create a .github/comment-agent.yml file in the default branch to enable it. Example configuration:

# A mapping of keyword aliases to event type. Form of match:event type.
# Required.
aliasMappings:
  "[BuildPlease]": "Build_Action"
  ?buildme: "Build_Action"
  ?triage: triage

# Determines if alias matching is case sensitive.
# Optional. Defaults to true.
caseSensitive: true

# A mapping of event types to user group permissions.
# Form of event type:group name or combined names (Explained lower in the README). 
# Optional, defaults to CONTRIBUTOR or OWNER for each.
permissionMappings:
  "BuildAction": [MEMBER, CONTRIBUTOR, PRAUTHOR]
  triage: 'CONTRIBUTOR'

Usage

You also need to set up an action triggered by the configuration-specified event type, example:

on:
  repository_dispatch:
    types: [Build_Action]

jobs:
	hello-world:
    steps:
      - run: echo "Hello World!"
			- run: 'echo "PR Number: ${{ github.event.client_payload.pr_number }}"'
			- run: 'echo "Comment Author: ${{ github.event.client_payload.comment_author }}"'
			- run: 'echo "PR Head full repo name: ${{ github.event.client_payload.pr_head_full_repo_name }}"
			- run: 'echo "PR Head ref: ${{ github.event.client_payload.pr_head_ref }}"'
			- run: 'echo "PR mergability: ${{ github.event.client_payload.mergable }}"'

As seen used above, the bot also sends some useful information to the action like the PR number and comment author login name as payload information. Feel free to request more sent information by filing an issue via GitHub. Note: This does not currently support pull request review comments for triggering, only normal PR comments.

Permission Field

The permission system supports allowing multiple permission levels to trigger an action, such as both someone who has previously committed to the repository and members of the organization that owns the repository. For an explanation and list of the levels, see here. The bot also supports PRAUTHOR for the author of the pull request. Adding multiple levels is accomplished through the use of putting the levels in a yaml list.

Contributing

Read the CONTRIBUTING guide for information.

License

Licensed under ISC. See LICENSE for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.