pr-discord-notifier

command module
v0.0.0-...-8a5e9cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 20 Imported by: 0

README

pr-discord-notifier

pr-discord-notifier is a discord bot designed to enhance your development workflow by receiving real-time GitHub pull request notifications directly to discord.

Motivation

While enrolled in the course DD2480 Software Engineering Fundamentals during my first year of my MSc in Computer Science, my project group and I decided to centralize all communications through Discord. Therefore, I built this bot to make it easier for us to stay up to date on pull requests.

Features

The bot sends well-informed and formatted Discord embed messages with issue linking when a pull request is:

  • Opened
  • Edited
  • Closed

Example opened pr message

drawing

The closed and edited embed messages follow similar formatting.

Technologies

  • Go
  • AWS EC2 Free tier instance
  • Discord API
  • GitHub webhooks
  • Caddy as a reverse proxy and automatic SSL certificate handling to expose webhook receiver endpoint through HTTPS
  • GitHub Actions CI/CD pipeline

Requirements

  • Go 1.17+

Installation

$ git clone https://github.com/asirago/pr-discord-notifier.git

$ cd pr-discord-notifier

$ go get .

$ go build ./...

Configuration

Configurations options must be set in a TOML file.

Example TOML file

port = 1337
channel = "Channel ID"
guild = "Guild/Server ID"
token = "Discord Application Bot Token"
repo = "Repo you want to link to"
project = "Link to project management tool e.g. GitHub kanban"
environment = "dev | production"

To run the bot locally

  • Specify the name of the config file with the --config flag (required)
  • The .toml file extension is optional
$ ./pr-discord-notifier --config config

or

$ ./pr-discord-notifier --config config.toml

Flags and Environment variables

Corresponding fields in toml file can also be set as flags or environment variables. The prioritization order is as following:

  • Flags
  • Environmental variables
  • TOML file

Example of setting flags:

$ ./pr-discord-notifier --config config.toml --port 8080 --token YOURTOKEN

Bot Usage Manual

/help - Displays a usage manual for the available commands.

/repo - Retrieves the link to the GitHub repository associated with this Discord server.

/set_repo [repo_link] - Sets the link to the GitHub repository for this Discord server.

/project - Retrieves the link to the project management tool

/set_project [project_link] - Sets the link to the project management tool for this Discord server.

/source - Retrieves the link to the GitHub repository containing the source code of this Discord bot.

/channel - Retrieves the channel where pull request notifications will be sent.

/set_channel [channel_id] or [#channel] - Sets the channel for pull request notifications.

LICENSE

This project is licensed under the terms of the MIT License. See the LICENSE file for more details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL