···311311 Combined string
312312 Comments []Comment
313313 SourceRev string // include the rev that was used to create this submission: only for branch/fork PRs
314314+ MergeBase string // merge-base of source and target at submission time
314315315316 // meta
316317 Created time.Time
···15221522 Stack models.Stack
1523152315241524 // Workflow warning state for fork-based pulls without a pipeline on the
15251525- // latest commit. WorkflowsChanged and ChangedWorkflowFiles are computed
15261526- // from the latest round's patch.
15251525+ // latest commit, derived from the spindle's workflow-definition
15261526+ // fingerprints at the pull head and its merge-base with the target branch.
15271527 WorkflowsChanged bool
15281528 ChangedWorkflowFiles []string
15291529 HasPipeline bool
···88 "tangled.org/core/api/tangled"
99 "tangled.org/core/appview/db"
1010 "tangled.org/core/appview/models"
1111- "tangled.org/core/patchutil"
1212- "tangled.org/core/workflow"
1311)
1414-1515-func changedWorkflowFiles(patch string) ([]string, error) {
1616- files, err := patchutil.AsDiff(patch)
1717- if err != nil {
1818- return nil, err
1919- }
2020-2121- var changed []string
2222- for _, f := range files {
2323- if f == nil {
2424- continue
2525- }
2626- for _, name := range []string{f.NewName, f.OldName} {
2727- if name != "" && strings.HasPrefix(name, workflow.WorkflowDir+"/") {
2828- changed = append(changed, name)
2929- break
3030- }
3131- }
3232- }
3333- return changed, nil
3434-}
35123613// TriggerCi manually triggers a CI pipeline for a fork-based pull request.
3714// authorized against and recorded under the target repo, but checked out
···7855 return
7956 }
80578181- changedFiles, err := changedWorkflowFiles(latest.CombinedPatch())
5858+ workflowsChanged, changedFiles, err := s.workflowChangeFromSpindle(r, f, pull)
8259 if err != nil {
8383- fail("failed to inspect the latest round's patch", err)
6060+ // without the fingerprint comparison there is no way to tell fork
6161+ // workflows apart from reviewed ones, so refuse to run them
6262+ fail("failed to verify the workflow definitions of this round", err)
8463 return
8564 }
8686- if len(changedFiles) > 0 && r.URL.Query().Get("confirm") != "1" {
6565+ if workflowsChanged && r.URL.Query().Get("confirm") != "1" {
8766 fail(fmt.Sprintf("workflow files changed in this round (%s); review before running", strings.Join(changedFiles, ", ")), nil)
8867 return
8968 }