Skip to content

Commit

Permalink
fix(api): support schedule in filter (#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
wass3rw3rk committed Jul 6, 2023
1 parent a6277ab commit 900608b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
29 changes: 28 additions & 1 deletion api/build/list_org.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,33 @@ import (
// required: true
// type: string
// - in: query
// name: event
// description: Filter by build event
// type: string
// enum:
// - comment
// - deployment
// - pull_request
// - push
// - schedule
// - tag
// - in: query
// name: branch
// description: Filter builds by branch
// type: string
// - in: query
// name: status
// description: Filter by build status
// type: string
// enum:
// - canceled
// - error
// - failure
// - killed
// - pending
// - running
// - success
// - in: query
// name: page
// description: The page of results to retrieve
// type: integer
Expand Down Expand Up @@ -109,7 +136,7 @@ func ListBuildsForOrg(c *gin.Context) {
// verify the event provided is a valid event type
if event != constants.EventComment && event != constants.EventDeploy &&
event != constants.EventPush && event != constants.EventPull &&
event != constants.EventTag {
event != constants.EventTag && event != constants.EventSchedule {
retErr := fmt.Errorf("unable to process event %s: invalid event type provided", event)

util.HandleError(c, http.StatusBadRequest, retErr)
Expand Down
9 changes: 5 additions & 4 deletions api/build/list_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ import (
// description: Filter by build event
// type: string
// enum:
// - push
// - comment
// - deployment
// - pull_request
// - push
// - schedule
// - tag
// - deployment
// - comment
// - in: query
// name: commit
// description: Filter builds based on the commit hash
Expand Down Expand Up @@ -159,7 +160,7 @@ func ListBuildsForRepo(c *gin.Context) {
// verify the event provided is a valid event type
if event != constants.EventComment && event != constants.EventDeploy &&
event != constants.EventPush && event != constants.EventPull &&
event != constants.EventTag {
event != constants.EventTag && event != constants.EventSchedule {
retErr := fmt.Errorf("unable to process event %s: invalid event type provided", event)

util.HandleError(c, http.StatusBadRequest, retErr)
Expand Down

0 comments on commit 900608b

Please sign in to comment.