github_sprinter

package module
v0.0.0-...-d0f8027 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2019 License: MIT Imports: 14 Imported by: 0

README

github-sprinter

Go Report Card CodeFactor Codacy Badge MIT

CLI managing GitHub milestones as sprints with YAML file.
Strongly inspired by b4b4r07/github-labeler.

screenshot

Installation

$ go get -u github.com/micnncim/github-sprinter/cmd/github-sprinter

Usage

$ github-sprinter

Specify manifest (default=sprint.yaml).

$ github-sprinter -manifest manifest.yaml

Support dry-run.

$ github-sprinter -dry-run

Update (including deletion) available.
If not specify -update, github-sprinter will not delete any milestone and will create some milestones. Even though github-sprinter deletes some milestones, only open milestones will deleted.

$ github-sprinter -update

Manifest example

sprint:
  title_format: Sprint {{ .SID }} ({{ .StartOn }}-{{ .DueOn }})
  duration: 168h # 1 week (24h * 7d = 168h)
  terms:
    - start_on: 2019/04/01
      due_on: 2020/03/31
    - start_on: 2020/04/01
      due_on: 2021/03/31
  ignore:
    terms:
      - start_on: 2019/08/01
        due_on: 2019/08/14
      - start_on: 2019/12/27
        due_on: 2020/01/01
    edge_weekdays:
      - Saturday
      - Sunday

repos:
  - name: micnncim/github-sprinter
Use case
-update
  • Change duration of each sprint

Change sprint.duration (sprint.title_format sprint.terms sprint.ignore)
⚠ This operation DELETEs all open milestone once and creates new milestones (it means the links between milestones and issues will be removed)

sprint:
- duration: 168h # 1 week (24h * 7d = 168h)
+ duration: 120h # 5 days (24h * 5d = 120h)
  • Remove all milestones from some repository

Remove all sprint.terms and stay repos.name

sprint:
  terms:
-    - start_on: 2019/04/01
-      due_on: 2020/03/31
-    - start_on: 2020/04/01
-      due_on: 2021/03/31

repos:
  - name: micnncim/github-sprinter
  • Add repository for the existing milestones

Remove the repositories where you don't want to change anything and add the repositories you want

repos:
- - name: micnncim/github-sprinter-1
- - name: micnncim/github-sprinter-2
+ - name: micnncim/github-sprinter-3

LICENSE

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration string

func (Duration) Parse

func (d Duration) Parse() (time.Duration, error)

type Ignore

type Ignore struct {
	Terms    []*Term   `yaml:"terms"`
	Weekdays []Weekday `yaml:"edge_weekdays"`
}

func (*Ignore) OmitIgnored

func (i *Ignore) OmitIgnored(startOn, dueOn time.Time, duration time.Duration) (validStartOn, validDueOn time.Time, err error)

type Issue

type Issue struct {
	Title string
	URL   string
}

type IssueService

type IssueService service

func (*IssueService) ListByMilestone

func (s *IssueService) ListByMilestone(ctx context.Context, owner, repo string, milestone *Milestone) ([]*Issue, error)

type Manifest

type Manifest struct {
	Sprint *Sprint `yaml:"sprint"`
	Repos  []*Repo `yaml:"repos"`
}

type Milestone

type Milestone struct {
	Number      int
	SID         int // Sprint ID
	Title       string
	State       string
	Description string
	StartOn     string
	DueOn       string
}

func NewMilestone

func NewMilestone(sid int, titleFmt string, startOn, dueOn time.Time) (*Milestone, error)

func (*Milestone) ParseDate

func (m *Milestone) ParseDate() (startOn, dueOn time.Time, err error)

type MilestoneService

type MilestoneService service

func (*MilestoneService) Create

func (s *MilestoneService) Create(ctx context.Context, owner, repo string, milestone *Milestone) error

func (*MilestoneService) Delete

func (s *MilestoneService) Delete(ctx context.Context, owner, repo string, milestone *Milestone) error

func (*MilestoneService) List

func (s *MilestoneService) List(ctx context.Context, owner, repo string) ([]*Milestone, error)

type Repo

type Repo struct {
	Name string `yaml:"name"`
}

type Sprint

type Sprint struct {
	TitleFormat string   `yaml:"title_format"`
	Duration    Duration `yaml:"duration"`
	Terms       []*Term  `yaml:"terms"`
	Ignore      *Ignore  `yaml:"ignore"`
}

func (*Sprint) GenerateMilestones

func (s *Sprint) GenerateMilestones() ([]*Milestone, error)

type Sprinter

type Sprinter struct {
	Manifest *Manifest
	// contains filtered or unexported fields
}

func NewSprinter

func NewSprinter(ctx context.Context, configPath string, dryRun, update bool) (*Sprinter, error)

func (*Sprinter) ApplyManifest

func (s *Sprinter) ApplyManifest(ctx context.Context, repository *Repo) error

type Term

type Term struct {
	StartOn string `yaml:"start_on"`
	DueOn   string `yaml:"due_on"`
}

func (*Term) Parse

func (t *Term) Parse() (startOn, dueOn time.Time, err error)

type Weekday

type Weekday string

func (Weekday) Parse

func (w Weekday) Parse() time.Weekday

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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