0.0.1-4 • Published 6 years ago

@github-hooks/comments v0.0.1-4

Weekly downloads
3
License
ISC
Repository
-
Last release
6 years ago

github-hooks-comment

A github-hooks plugin that automaticly put a comment against a newly created issue or pull request.

Getting Started

Plugin example:

comments({
    // message to post
    message: 'Thanks for creating a new issue',
    // github token
    token: process.env.GITHUB_TOKEN
});

Parameters

  1. message (String): The message to post back to Github once your event has been triggered.
  2. token (String): Your github token (required to post)

Example

In the example below we have setup the github-hooks-comments plugin with new issues and pull requests.

const hooks = require('@github-hooks');
const comments = require('@github-hooks-comments');

// Setup config. In this example we are using the comments plugin on issues that are created and opened. Also we have configured opened pull requests
hooks.setConfig({
    issues: {
        created: {
            plugins: [
                comments({
                    message: 'Thanks for creating a new issue',
                    token: process.env.GITHUB_TOKEN
                })
            ]
        },
        opened: {
            plugins: [
                comments({
                    message: 'Thanks for opening a new issue',
                    token: process.env.GITHUB_TOKEN
                })
            ]
        }
    },
    pull_request: {
        opened: {
            plugins: [
                comments({
                    message: 'This is an automaticed response. Thank you for submitting a pull request',
                    token: process.env.GITHUB_TOKEN
                })
            ]
        }
    }
});

hooks.run({ port: 3000 });