···2626 Id string `json:"id" cborgen:"id"`
2727 // repo: Repository DID
2828 Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
2929+ // sourceRepo: Repository DID that the commit was checked out from, if different from repo (e.g. a fork for a fork-based pull request)
3030+ SourceRepo *string `json:"sourceRepo,omitempty" cborgen:"sourceRepo,omitempty"`
2931 // trigger: Trigger event metadata
3032 Trigger *CiPipeline_Trigger `json:"trigger" cborgen:"trigger"`
3133 // workflows: Triggered workflows
···49495050// Pipeline_PullRequestTriggerData is a "pullRequestTriggerData" in the sh.tangled.pipeline schema.
5151type Pipeline_PullRequestTriggerData struct {
5252- Action string `json:"action" cborgen:"action"`
5353- SourceBranch string `json:"sourceBranch" cborgen:"sourceBranch"`
5454- SourceSha string `json:"sourceSha" cborgen:"sourceSha"`
5555- TargetBranch string `json:"targetBranch" cborgen:"targetBranch"`
5252+ // pull: AT-URI of the sh.tangled.repo.pull record this run belongs to
5353+ Pull *string `json:"pull,omitempty" cborgen:"pull,omitempty"`
5454+ SourceBranch string `json:"sourceBranch" cborgen:"sourceBranch"`
5555+ SourceSha string `json:"sourceSha" cborgen:"sourceSha"`
5656+ TargetBranch string `json:"targetBranch" cborgen:"targetBranch"`
5657}
57585859// Pipeline_PushTriggerData is a "pushTriggerData" in the sh.tangled.pipeline schema.
···6970 PullRequest *Pipeline_PullRequestTriggerData `json:"pullRequest,omitempty" cborgen:"pullRequest,omitempty"`
7071 Push *Pipeline_PushTriggerData `json:"push,omitempty" cborgen:"push,omitempty"`
7172 Repo *Pipeline_TriggerRepo `json:"repo" cborgen:"repo"`
7373+ // sourceRepo: Repository DID that code and workflow definitions are checked out from, when different from repo (e.g. a fork's commit for a fork-based manual trigger). If absent, source uses repo itself.
7474+ SourceRepo *string `json:"sourceRepo,omitempty" cborgen:"sourceRepo,omitempty"`
7275}
73767477// Pipeline_TriggerRepo is a "triggerRepo" in the sh.tangled.pipeline schema.
···2929 "type": "string",
3030 "description": "Commit Id this pipeline is running on"
3131 },
3232+ "sourceRepo": {
3333+ "type": "string",
3434+ "format": "did",
3535+ "description": "Repository DID that the commit was checked out from, if different from repo (e.g. a fork for a fork-based pull request)"
3636+ },
3237 "createdAt": {
3338 "type": "string",
3439 "format": "datetime"
···44 "defs": {
55 "main": {
66 "type": "procedure",
77- "description": "Manually trigger a pipeline at an explicit commit. Runs the named workflows, or every workflow defined in the repo when none are named.",
77+ "description": "Trigger a pipeline at an explicit commit. Runs the named workflows, or every workflow defined in the repo when none are named.",
88 "input": {
99 "encoding": "application/json",
1010 "schema": {
1111 "type": "object",
1212- "required": ["repo", "sha"],
1212+ "required": ["repo", "trigger"],
1313 "properties": {
1414 "repo": {
1515 "type": "string",
1616- "format": "at-uri",
1717- "description": "AT-URI of the sh.tangled.repo record"
1818- },
1919- "sha": {
2020- "type": "string",
2121- "minLength": 40,
2222- "maxLength": 40,
2323- "description": "commit SHA to run the pipeline at"
1616+ "format": "did",
1717+ "description": "Target repository DID. Auth is checked against this repo."
2418 },
2525- "ref": {
2626- "type": "string",
2727- "description": "optional ref the SHA was resolved from, for display"
1919+ "trigger": {
2020+ "type": "union",
2121+ "refs": [
2222+ "sh.tangled.ci.trigger#manual",
2323+ "sh.tangled.ci.trigger#pullRequest"
2424+ ],
2525+ "description": "Trigger metadata for this dispatch."
2826 },
2927 "workflows": {
3028 "type": "array",
···25252626const ActorDid = serviceauth.ActorDid
27272828-// ErrNoMatchingWorkflows is returned when a manual dispatch resolves to no
2929-// workflows to run: the repo defines none at the requested commit, or none of
3030-// the requested workflow names exist.
3128var ErrNoMatchingWorkflows = errors.New("no workflows to run")
32293333-// PipelineTrigger builds and enqueues a manually-dispatched pipeline. It is
3434-// implemented by *spindle.Spindle, which owns the queue and engines; the xrpc
3535-// handler only does auth and input validation before delegating here.
3030+// this is to break an import cycle. spindle imports this package for Xrpc,
3131+// so this package can't import *spindle.Spindle back.
3632type PipelineTrigger interface {
3737- TriggerManual(ctx context.Context, repoDid syntax.DID, sha, ref string, workflows []string) (syntax.ATURI, error)
3333+ TriggerManual(ctx context.Context, repoDid syntax.DID, sha, ref string, workflows []string, sourceRepo syntax.DID, pull PullContext, inputs []*tangled.Pipeline_Pair) (syntax.ATURI, error)
3434+}
3535+3636+type PullContext struct {
3737+ IsPullRequest bool
3838+ Pull syntax.ATURI
3939+ SourceBranch string
4040+ TargetBranch string
3841}
39424043type Xrpc struct {