Monorepo for Tangled tangled.org
1

Configure Feed

Select the types of activity you want to include in your feed.

core / api / tangled / cipipeline.go
3.1 kB 92 lines
1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 3package tangled 4 5// schema: sh.tangled.ci.pipeline 6 7import ( 8 "encoding/json" 9 "fmt" 10 11 "github.com/bluesky-social/indigo/lex/util" 12) 13 14const ( 15 CiPipelineNSID = "sh.tangled.ci.pipeline" 16) 17 18// CiPipeline is a "main" in the sh.tangled.ci.pipeline schema. 19// 20// A CI pipeline. Record-like, but owned by the spindle rather than a PDS. 21type CiPipeline struct { 22 // commit: Commit Id this pipeline is running on 23 Commit string `json:"commit" cborgen:"commit"` 24 CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` 25 // id: Spindle-local pipeline id 26 Id string `json:"id" cborgen:"id"` 27 // repo: Repository DID 28 Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` 29 // sourceRepo: Repository DID that the commit was checked out from, if different from repo (e.g. a fork for a fork-based pull request) 30 SourceRepo *string `json:"sourceRepo,omitempty" cborgen:"sourceRepo,omitempty"` 31 // trigger: Trigger event metadata 32 Trigger *CiPipeline_Trigger `json:"trigger" cborgen:"trigger"` 33 // workflows: Triggered workflows 34 Workflows []*CiPipeline_Workflow `json:"workflows" cborgen:"workflows"` 35} 36 37// Trigger event metadata 38type CiPipeline_Trigger struct { 39 CiTrigger_Push *CiTrigger_Push 40 CiTrigger_PullRequest *CiTrigger_PullRequest 41 CiTrigger_Manual *CiTrigger_Manual 42} 43 44func (t *CiPipeline_Trigger) MarshalJSON() ([]byte, error) { 45 if t.CiTrigger_Push != nil { 46 t.CiTrigger_Push.LexiconTypeID = "sh.tangled.ci.trigger#push" 47 return json.Marshal(t.CiTrigger_Push) 48 } 49 if t.CiTrigger_PullRequest != nil { 50 t.CiTrigger_PullRequest.LexiconTypeID = "sh.tangled.ci.trigger#pullRequest" 51 return json.Marshal(t.CiTrigger_PullRequest) 52 } 53 if t.CiTrigger_Manual != nil { 54 t.CiTrigger_Manual.LexiconTypeID = "sh.tangled.ci.trigger#manual" 55 return json.Marshal(t.CiTrigger_Manual) 56 } 57 return nil, fmt.Errorf("cannot marshal empty enum") 58} 59func (t *CiPipeline_Trigger) UnmarshalJSON(b []byte) error { 60 typ, err := util.TypeExtract(b) 61 if err != nil { 62 return err 63 } 64 65 switch typ { 66 case "sh.tangled.ci.trigger#push": 67 t.CiTrigger_Push = new(CiTrigger_Push) 68 return json.Unmarshal(b, t.CiTrigger_Push) 69 case "sh.tangled.ci.trigger#pullRequest": 70 t.CiTrigger_PullRequest = new(CiTrigger_PullRequest) 71 return json.Unmarshal(b, t.CiTrigger_PullRequest) 72 case "sh.tangled.ci.trigger#manual": 73 t.CiTrigger_Manual = new(CiTrigger_Manual) 74 return json.Unmarshal(b, t.CiTrigger_Manual) 75 76 default: 77 return nil 78 } 79} 80 81// CiPipeline_Workflow is a "workflow" in the sh.tangled.ci.pipeline schema. 82type CiPipeline_Workflow struct { 83 Error *string `json:"error,omitempty" cborgen:"error,omitempty"` 84 FinishedAt *string `json:"finishedAt,omitempty" cborgen:"finishedAt,omitempty"` 85 // id: Spindle-local workflow id. Unique per pipeline, usually same as name. 86 Id string `json:"id" cborgen:"id"` 87 // name: Name of the workflow 88 Name string `json:"name" cborgen:"name"` 89 StartedAt *string `json:"startedAt,omitempty" cborgen:"startedAt,omitempty"` 90 // status: Workflow status 91 Status string `json:"status" cborgen:"status"` 92}