autocut

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

Autocut

Automatically create new issues, or update existing ones by deduping on the title.

With this tool, you can repeatedly "cut" the same issue over and over, knowing it'll only be created once, updated if it's stale, and re-open if it was recently closed. It was built to support system monitoring.

You can use it as a CLI, or as a Go library in your application.

Build it

% go build ./cmd/autocut/...

Use it

First, set GITHUB_TOKEN to your GitHub token.

% export GITHUB_TOKEN=abc123

Then make a new issue that something is wrong:

% ./autocut -owner allenai -repo aimichal -dur 10m -title "something is wrong" -details "bad habits"
Opened new issue https://github.com/allenai/aimichal/issues/27.

Any time in the next 10 minutes, repeating this will do nothing:

% ./autocut -owner allenai -repo aimichal -dur 10m -title "something is wrong" -details "bad habits"
Found recently updated issue, so did nothing: https://github.com/allenai/aimichal/issues/27

But after 10 minutes, running this will update the issue with a comment:

% ./autocut -owner allenai -repo aimichal -dur 10m -title "something is wrong" -details "such bad things are happening"
Found a stale issue, so commented on it: https://github.com/allenai/aimichal/issues/27

If this issue is closed, then running this will re-open the issue within 10 minutes. After 10 minutes, a new issue will be created.

Probably a good default duration to use is 24 hours (-dur 24h).

Documentation

Index

Constants

View Source
const (
	None                        CutCode = ""
	IgnoredRecentlyUpdatedIssue         = "found a recently updated issue, so did nothing"
	UpdatedStaleIssue                   = "updated a stale issue"
	ReopenedRecentIssue                 = "re-opened a recently closed issue"
	OpenedNewIssue                      = "opened a new issue"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Autocut

type Autocut struct {
	Client       *github.Client
	Owner        string
	Repo         string
	AgeThreshold time.Duration
}

func (*Autocut) Cut

func (ac *Autocut) Cut(ctx context.Context, title, details string) (CutResult, error)

type CutCode

type CutCode string

type CutResult

type CutResult struct {
	Code     CutCode
	IssueURL string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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