An open API service indexing awesome lists of open source software.

https://github.com/timja/github-comment-ops

A tool for managing GitHub issues and pull requests via comment-ops. It uses GitHub webhooks to scale across repositories without needing to add a GitHub action to each of them.
https://github.com/timja/github-comment-ops

github issue-management pull-request-management webhooks

Last synced: 4 months ago
JSON representation

A tool for managing GitHub issues and pull requests via comment-ops. It uses GitHub webhooks to scale across repositories without needing to add a GitHub action to each of them.

Awesome Lists containing this project

README

          

# GitHub issue and pull request management with Comment-Ops

A tool for managing GitHub issues and pull requests via comment-ops.
It uses GitHub webhooks to scale across repositories without needing to add a GitHub action to each of them.

GitHub apps are used for authentication to limit the required permissions.

## Configuration

The app is configured with a `.github/comment-ops.yml` file in the main branch of the repository.
This can also be applied organization wide by creating it in the organization's `.github` repository.

_Note: This file is required all commands are disabled by default._

The order of configuration is:

`default config` → `organization` → `repository`

Default configuration:

```yaml
commands:
close:
enabled: false
label:
allowedLabels: [] # any label is allowed
enabled: false
removeLabel:
allowedLabels: [] # any label is allowed
enabled: false
reopen:
enabled: false
reviewer:
enabled: false
transfer:
enabled: false
```

## Getting started

First you will need to create a GitHub app. Add the permissions required for the commands you are using (see next section), and tick "Subscribe to events" > "Issue comment"

Add a webhook to the app pointing at your endpoint, the path for the webhook receiver is `/api/github/webhooks`.

This app is multiple organization aware and doesn't need any additional configuration to run in multiple organizations, you just need to install it on them.

_Note: You can't interact across organizations, like requesting reviews from teams in different organizations or transferring issues, this is a GitHub limitation._

### Local development

The easiest way to develop this locally is to use [smee](https://smee.io).

Run `smee --path /api/github/webhooks` and point your webhook to the smee url that is outputted e.g. https://smee.io/Mrl4d3W9AUxeaaa

The application runs on port 3000 by default, this can be customized with the `PORT` environment variable.

You can also use the npm script `npm run tunnel` which will run smee for you.

### Chart deployment

You can deploy this application to Kubernetes with the helm chart included in this repo:

```
helm repo add github-comment-ops https://timja.github.io/github-comment-ops
helm install github-comment-ops github-comment-ops/github-comment-ops
```

See more in the [chart README](charts/github-comment-ops/README.md)

### Required environment variables

- `GITHUB_APP_ID`
- `GITHUB_APP_PRIVATE_KEY`
- Either the private key as a string or a file path prefixed by `file:`, e.g. `file:my-key.pem`
- `WEBHOOK_SECRET`

## Supported commands

### /close

Closes the current issue

#### Permissions required

- Issues
- Read and write

### /label

Adds a label to the current issue or pull request

#### Permissions required

- Issues
- Read and write
- Pull requests
- Read and write

### /remove-label

Removes a label from the current issue or pull request

#### Permissions required

- Issues
- Read and write
- Pull requests
- Read and write

### /reopen

Reopens the current issue

#### Permissions required

- Issues
- Read and write

### /reviewer(s)

Adds reviewers to the pull request.

_Note: If a team exists but the team doesn't have read access to the repository this will silently fail._

#### Permissions required

- Pull requests
- Read and write
- Organizations -> Members
- Read-only

### /transfer

Transfers a GitHub issue to another repository in the same organization.

#### Permissions required

- Contents
- Read and write
- Issues
- Read and write