-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b23a1ed
Showing
16 changed files
with
1,625 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.envrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
# Build container | ||
FROM golang:1.13 as build | ||
WORKDIR /go/src/app | ||
COPY . . | ||
ENV CGO_ENABLED=0 | ||
RUN go get ./... | ||
RUN go build -o /triage ./cmd/triage/main.go | ||
|
||
# Runtime container | ||
FROM alpine:3.10 | ||
RUN apk --no-cache add ca-certificates | ||
COPY --from=build /triage /triage | ||
CMD ["/triage"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
|
||
## Triage | ||
|
||
Interactive command-line GitHub issue & notification triaging tool. | ||
|
||
## Installation | ||
|
||
Via `go get`: | ||
|
||
``` | ||
$ go get github.com/tj/triage/... | ||
``` | ||
|
||
Via `ops run` by [CTO.ai](https://cto.ai/): | ||
|
||
``` | ||
$ ops run @tj/triage | ||
``` | ||
|
||
## Features | ||
|
||
Some of the current features include: | ||
|
||
- Quickly view and search notifications | ||
- View issue details, labels, and comments | ||
- View notifications without marking them as read | ||
- Mark notifications as read, or unsubscribe entirely | ||
- Unwatch entire repositories | ||
- Add and remove issue labels | ||
- Add comments to issues | ||
|
||
Upcoming features may include things like: | ||
|
||
- Global priority management across all of your projects | ||
- Automatically prioritize based on your GitHub sponsors | ||
- Templated comment responses | ||
|
||
## Screenshots | ||
|
||
Notifications listing: | ||
|
||
![](https://apex-software.imgix.net/github/tj/triage/notifications.png) | ||
|
||
Filtering notifications with the `/` search: | ||
|
||
![](https://apex-software.imgix.net/github/tj/triage/search.png) | ||
|
||
Viewing issue details: | ||
|
||
![](https://apex-software.imgix.net/github/tj/triage/issue.png) | ||
|
||
Adding and removing labels: | ||
|
||
![](https://apex-software.imgix.net/github/tj/triage/labels.png) | ||
|
||
Leaving a comment: | ||
|
||
![](https://apex-software.imgix.net/github/tj/triage/comment.png) | ||
|
||
--- | ||
|
||
[![GoDoc](https://godoc.org/github.com/tj/triage?status.svg)](https://godoc.org/github.com/tj/triage) | ||
![](https://img.shields.io/badge/license-MIT-blue.svg) | ||
![](https://img.shields.io/badge/status-stable-green.svg) | ||
|
||
## Sponsors | ||
|
||
This project is [sponsored](https://github.com/sponsors/tj) by [CTO.ai](https://cto.ai/), making it easy for development teams to create and share workflow automations without leaving the command line. | ||
|
||
[![](https://apex-software.imgix.net/github/sponsors/cto.png)](https://cto.ai/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package triage | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/google/go-github/v28/github" | ||
) | ||
|
||
// clientKey is a private context key. | ||
type clientKey struct{} | ||
|
||
// NewClientContext returns a new context with client. | ||
func NewClientContext(ctx context.Context, v *github.Client) context.Context { | ||
return context.WithValue(ctx, clientKey{}, v) | ||
} | ||
|
||
// ClientFromContext returns client from context. | ||
func ClientFromContext(ctx context.Context) (*github.Client, bool) { | ||
v, ok := ctx.Value(clientKey{}).(*github.Client) | ||
return v, ok | ||
} | ||
|
||
// MustClientFromContext returns client from context. | ||
func MustClientFromContext(ctx context.Context) *github.Client { | ||
v, ok := ctx.Value(clientKey{}).(*github.Client) | ||
if !ok { | ||
panic("missing github client in context") | ||
} | ||
return v | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
"github.com/google/go-github/v28/github" | ||
"github.com/tj/go-config" | ||
"github.com/tj/go-tea" | ||
"golang.org/x/oauth2" | ||
|
||
"github.com/tj/triage" | ||
) | ||
|
||
func main() { | ||
ctx := context.Background() | ||
|
||
// require GITHUB_TOKEN | ||
token := os.Getenv("GITHUB_TOKEN") | ||
if token == "" { | ||
fmt.Fprintf(os.Stderr, "\n The \033[1mGITHUB_TOKEN\033[m environment variable is required.\n") | ||
fmt.Fprintf(os.Stderr, "\n You can generate a personal access token at https://github.com/settings/tokens,\n then add it to your shell profile, .envrc, or simply `export GITHUB_TOKEN=xxxxxxxx`.\n\n") | ||
os.Exit(1) | ||
} | ||
|
||
// http client | ||
httpClient := oauth2.NewClient(ctx, oauth2.StaticTokenSource( | ||
&oauth2.Token{ | ||
AccessToken: token, | ||
}, | ||
)) | ||
ctx = triage.NewClientContext(ctx, github.NewClient(httpClient)) | ||
|
||
// load config | ||
var c triage.Config | ||
err := config.LoadHome(".triage.json", &c) | ||
if err != nil { | ||
log.Fatalf("error loading config: %s", err) | ||
} | ||
ctx = triage.NewConfigContext(ctx, &c) | ||
|
||
// start program | ||
program := tea.NewProgram(triage.Init, triage.Update, triage.View) | ||
err = program.Start(ctx) | ||
if err != nil { | ||
log.Fatalf("error: %s\r\n", err) | ||
} | ||
} |
Oops, something went wrong.