distea/forge/forge.go
John Olheiser bba74a4923 Add extra context for PRs (#12)
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: gitea/distea#12
2022-09-08 00:28:34 +08:00

61 lines
963 B
Go

package forge
import (
"errors"
"regexp"
"time"
)
var (
issueRe = regexp.MustCompile(`#(\d+)`)
ErrSourceFileOnly = errors.New("source is for files only")
)
// Commit is a git commit from a forge API
type Commit struct {
Author User
Message string
SHA string
URL string
Time time.Time
Additions int
Deletions int
Verified bool
}
// Issue is a forge issue
type Issue struct {
User User
Title string
URL string
Body string
Labels []string
State string
Created time.Time
Closed time.Time
Comments int
PullRequest *PullRequest
}
// PullRequest is a forge pull request
type PullRequest struct {
CanMerge bool
Base string
Head string
Diff string
Patch string
}
// User is a forge user
type User struct {
Username string
URL string
Image string
}
// File is a forge file
type File struct {
Contents string
URL string
}