All Projects → parkr → Auto Reply

parkr / Auto Reply

Licence: bsd-3-clause
➿ Handle GitHub webhooks and manage issues on your repositories. Currently runs @jekyllbot.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Auto Reply

react-preview
a GitHub App built with probot that generates preview links for react based projects.
Stars: ✭ 14 (-77.42%)
Mutual labels:  github-api, webhooks
GitHubAPI
[UNMAINTAINED] This is a simple Object Oriented wrapper for GitHub API v3, written with PHP7.
Stars: ✭ 36 (-41.94%)
Mutual labels:  github-api, webhooks
Github Connector
The GitHub Active Directory Connector allows managing GitHub organizations with Active Directory.
Stars: ✭ 27 (-56.45%)
Mutual labels:  github-api
Githubapi
Swift implementation of Github REST API v3
Stars: ✭ 55 (-11.29%)
Mutual labels:  github-api
Gitwar
🚀 Gitwar - Compete with Github
Stars: ✭ 44 (-29.03%)
Mutual labels:  github-api
Community User Profile
👨‍💻 Profile page, but for developers.
Stars: ✭ 32 (-48.39%)
Mutual labels:  github-api
Github3.py
Hi, I'm a library for interacting with GItHub's REST API in a convenient and ergonomic way. I work on Python 3.6+.
Stars: ✭ 1,029 (+1559.68%)
Mutual labels:  github-api
Postmark webhooks
Lightweight quickstart app for receiving and processing webhooks from Postmark
Stars: ✭ 14 (-77.42%)
Mutual labels:  webhooks
Shield
The core shield package.
Stars: ✭ 60 (-3.23%)
Mutual labels:  webhooks
Daily Hero
The bot that sends daily closed issues digest to our team
Stars: ✭ 38 (-38.71%)
Mutual labels:  github-api
Github
Ruby interface to GitHub API
Stars: ✭ 1,081 (+1643.55%)
Mutual labels:  github-api
Hbupdater
A simple python app for keeping your switch apps up-to-date using the github api.
Stars: ✭ 37 (-40.32%)
Mutual labels:  github-api
Gitgot
Semi-automated, feedback-driven tool to rapidly search through troves of public data on GitHub for sensitive secrets.
Stars: ✭ 964 (+1454.84%)
Mutual labels:  github-api
Gravekeeper
Informs users that a repo is not maintained anymore.
Stars: ✭ 46 (-25.81%)
Mutual labels:  github-api
Tent
Content management with Github hosted Markdown as an authoritative data source
Stars: ✭ 28 (-54.84%)
Mutual labels:  github-api
Automated Github Organization Invites
Quickly host a webpage allowing people to click and receive an invite to your Github Organization
Stars: ✭ 55 (-11.29%)
Mutual labels:  github-api
Webhooks Demo
Stars: ✭ 15 (-75.81%)
Mutual labels:  webhooks
Discord Webhooks
A simple lightweight Discord webhook client library.
Stars: ✭ 36 (-41.94%)
Mutual labels:  webhooks
Vk2discord
🔧 Автоматическая публикация записей из группы или профиля VK.COM в канал Discord
Stars: ✭ 45 (-27.42%)
Mutual labels:  webhooks
Nestjs Braintree
A module for braintree reoccurring payments and transactions 💳
Stars: ✭ 62 (+0%)
Mutual labels:  webhooks

auto-reply

An open source gardener. This is a technology for powering GitHub bots. It's really rough around the edges but it currently powers @jekyllbot.

Build Status

Configuring

If you want to configure a secret to validate your payload from GitHub, then set it as the environment variable GITHUB_WEBHOOK_SECRET. This is the same value you enter in the web interface when setting up the "Secret" for your webhook.

I could use your thoughts on this! Currently, it's a hodge-podge. The documentation for each package will provide more details on this. Currently we have the following packages, with varying levels of configuration:

  • affinity – assigns issues based on team mentions and those team captains. See Jekyll's docs for more info.
  • autopull – detects pushes to branches which start with pull/ and automatically creates a PR for them
  • chlog – creates GitHub releases when a new tag is pushed, and powers "@jekyllbot: merge (+category)"
  • jekyll/deprecate – comments on and closes issues to issues on certain repos with a per-repo stock message
  • jekyll/issuecomment – provides handlers for removing pending-feedback and stale labels when a comment comes through
  • labeler – removes pending-rebase label when a PR is pushed to and is mergeable (and helper functions for manipulating labels)
  • lgtm – adds a jekyllbot/lgtm CI status and handles LGTM counting

Installing

This is intended for use with servers, so you'd do something like:

package main

import (
	"flag"
	"log"
	"net/http"

	"github.com/parkr/auto-reply/affinity"
	"github.com/parkr/auto-reply/ctx"
	"github.com/parkr/auto-reply/hooks"
)

var context *ctx.Context

func main() {
	var port string
	flag.StringVar(&port, "port", "8080", "The port to serve to")
	flag.Parse()
	context = ctx.NewDefaultContext()

	http.HandleFunc("/_ping", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", "text/plain")
		w.Write([]byte("ok\n"))
	}))

	// Add your event handlers. Check out the documentation for the
	// github.com/parkr/auto-reply/hooks package to see all supported events.
	eventHandlers := hooks.EventHandlerMap{}

	// Build the affinity handler.
	aff := &affinity.Handler{}
	aff.AddRepo("myorg", "myproject")
	aff.AddTeam(context, 123) // @myorg/performance
	aff.AddTeam(context, 456) // @myorg/documentation

	// Add the affinity handler's various event handlers to the event handlers map :)
	eventHandlers.AddHandler(hooks.IssuesEvent, aff.AssignIssueToAffinityTeamCaptain)
	eventHandlers.AddHandler(hooks.IssueCommentEvent, aff.AssignIssueToAffinityTeamCaptainFromComment)
	eventHandlers.AddHandler(hooks.PullRequestEvent, aff.RequestReviewFromAffinityTeamCaptain)

	// Create the webhook handler. GlobalHandler takes the list of event handlers from
	// its configuration and fires each of them based on the X-GitHub-Event header from
	// the webhook payload.
	myOrgHandler := &hooks.GlobalHandler{
		Context:       context,
		EventHandlers: eventHandlers,
	}
	http.Handle("/_github/myproject", myOrgHandler)

	log.Printf("Listening on :%s", port)
	log.Fatal(http.ListenAndServe(":"+port, nil))
}

Writing Custom Handlers

For now, all you have to do is write a function which satisfies the hooks.EventHandler type. At the moment, each handler can accept only one type of event. If you want to accept the issue_comment event, then you should be able to perform a successful type assertion:

func MyIssueCommentHandler(context *ctx.Context, payload interface{}) error {
    event, err := payload.(*github.IssueCommentEvent)
    if err != nil {
        return context.NewError("MyIssueCommentHandler: hm, didn't get an IssueCommentEvent: %v", err)
    }

    // Handle your issue comment event in a type-safe way here.
}

Then you register that with your project. Taking the two examples above, you'd add MyIssueCommentHandler to the eventHandlers[hooks.IssueCommentEvent] array:

eventHandlers := hooks.EventHandlerMap{}
eventHandlers.AddHandler(hooks.IssueCommentEvent, MyIssueCommentHandler)

And it should work!

Optional: Mark-and-sweep Stale Issues

One big issue we have in Jekyll is "stale" issues, that is, issues which were opened and abandoned after a few months of activity. The code in cmd/mark-and-sweep-stale-issues is still Jekyll-specific but I'd love a PR which abstracts out the configuration into a file or something!

License

This code is licensed under BSD 3-clause as specified in the LICENSE file in this repository.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].