mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-29 12:02:55 +09:00
refactor: move build status to core package
This commit is contained in:
34
routers/api/bots/core/status.go
Normal file
34
routers/api/bots/core/status.go
Normal file
@ -0,0 +1,34 @@
|
||||
package core
|
||||
|
||||
// BuildStatus represents a build status
|
||||
type BuildStatus string
|
||||
|
||||
// enumerate all the statuses of bot build
|
||||
const (
|
||||
StatusSkipped BuildStatus = "skipped"
|
||||
StatusBlocked BuildStatus = "blocked"
|
||||
StatusDeclined BuildStatus = "declined"
|
||||
StatusWaiting BuildStatus = "waiting_on_dependencies"
|
||||
StatusPending BuildStatus = "pending"
|
||||
StatusRunning BuildStatus = "running"
|
||||
StatusPassing BuildStatus = "success"
|
||||
StatusFailing BuildStatus = "failure"
|
||||
StatusKilled BuildStatus = "killed"
|
||||
StatusError BuildStatus = "error"
|
||||
)
|
||||
|
||||
func (status BuildStatus) IsPending() bool {
|
||||
return status == StatusPending
|
||||
}
|
||||
|
||||
func (status BuildStatus) IsRunning() bool {
|
||||
return status == StatusRunning
|
||||
}
|
||||
|
||||
func (status BuildStatus) IsFailed() bool {
|
||||
return status == StatusFailing || status == StatusKilled || status == StatusError
|
||||
}
|
||||
|
||||
func (status BuildStatus) IsSuccess() bool {
|
||||
return status == StatusPassing
|
||||
}
|
Reference in New Issue
Block a user