package workflow
// PipelineSpec is the trigger plus workflows a pipeline was built from. it is
// stored as json with the job, so the tags are part of the on-disk format.
type PipelineSpec struct {
TriggerMetadata *TriggerMetadata `json:"triggerMetadata"`
Workflows []*WorkflowSpec `json:"workflows"`
}
type CloneSpec struct {
Depth int64 `json:"depth"`
Skip bool `json:"skip"`
Submodules bool `json:"submodules"`
Tags bool `json:"tags"`
}
type WorkflowSpec struct {
// audience is the OIDC aud claim of the workflow's id token, empty runs without one
Audience *string `json:"audience,omitempty"`
Clone *CloneSpec `json:"clone"`
Engine string `json:"engine"`
Name string `json:"name"`
Raw string `json:"raw"`
RunsOn []string `json:"runsOn,omitempty"`
}
type TriggerPair struct {
Key string `json:"key"`
Value string `json:"value"`
}
type ManualTriggerData struct {
Inputs []*TriggerPair `json:"inputs,omitempty"`
Ref *string `json:"ref,omitempty"`
Sha string `json:"sha"`
}
type PullRequestTriggerData struct {
Action *string `json:"action,omitempty"`
Pull *string `json:"pull,omitempty"`
Patch *string `json:"patch,omitempty"`
SourceBranch string `json:"sourceBranch"`
SourceSha string `json:"sourceSha"`
TargetBranch string `json:"targetBranch"`
}
type PushTriggerData struct {
NewSha string `json:"newSha"`
OldSha string `json:"oldSha"`
Ref string `json:"ref"`
}
type ScheduleTriggerData struct {
Ref string `json:"ref"`
ScheduledAt string `json:"scheduledAt"`
Sha string `json:"sha"`
}
type TriggerMetadata struct {
// actor is the account that caused the run, the repo owner for scheduled ones
Actor *string `json:"actor,omitempty"`
Kind string `json:"kind"`
Manual *ManualTriggerData `json:"manual,omitempty"`
PullRequest *PullRequestTriggerData `json:"pullRequest,omitempty"`
Push *PushTriggerData `json:"push,omitempty"`
Repo *TriggerRepo `json:"repo"`
Schedule *ScheduleTriggerData `json:"schedule,omitempty"`
// sourceRepo is the repo did the code is checked out from when it differs from repo (forks)
SourceRepo *string `json:"sourceRepo,omitempty"`
}
type TriggerRepo struct {
DefaultBranch string `json:"defaultBranch"`
Did string `json:"did"`
Knot string `json:"knot"`
Repo *string `json:"repo,omitempty"`
RepoDid *string `json:"repoDid,omitempty"`
}