1{{ define "title" }}pipelines · {{ .RepoInfo.FullName }}{{ end }}
2
3{{ define "extrameta" }}
4 {{ $title := "pipelines"}}
5 {{ $url := printf "https://tangled.org/%s/pipelines" .RepoInfo.FullName }}
6 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
7{{ end }}
8
9{{ define "repoContent" }}
10<div class="flex justify-between items-center gap-4">
11 <div class="w-full flex flex-col gap-2">
12 {{ range .Pipelines }}
13 {{ block "pipeline" (list $ .) }} {{ end }}
14 {{ else }}
15 <div class="py-6 w-fit flex flex-col gap-4 mx-auto">
16 <p>
17 No pipelines have been run for this repository yet. To get started:
18 </p>
19 {{ $bullet := "mx-2 text-xs bg-gray-200 dark:bg-gray-600 rounded-full size-5 flex items-center justify-center font-mono inline-flex align-middle" }}
20 <p>
21 <span class="{{ $bullet }}">1</span>First, choose a spindle in your
22 <a href="/{{ .RepoInfo.FullName }}/settings?tab=pipelines" class="underline">repository settings</a>.
23 </p>
24 <p>
25 <span class="{{ $bullet }}">2</span>Configure your CI/CD
26 <a href="https://tangled.org/@tangled.org/core/blob/master/docs/spindle/pipeline.md" class="underline">pipeline</a>.
27 </p>
28 <p><span class="{{ $bullet }}">3</span>Trigger a workflow with a push or a pull-request!</p>
29 </div>
30 {{ end }}
31 </div>
32</div>
33{{ end }}
34
35
36{{ define "pipeline" }}
37 {{ $root := index . 0 }}
38 {{ $p := index . 1 }}
39 <div class="py-2 bg-white dark:bg-gray-800 dark:text-white">
40 {{ block "pipelineHeader" $ }} {{ end }}
41 </div>
42{{ end }}
43
44{{ define "pipelineHeader" }}
45 {{ $root := index . 0 }}
46 {{ $p := index . 1 }}
47 {{ with $p }}
48 <div class="grid grid-cols-6 md:grid-cols-12 gap-2 items-center w-full">
49 <div class="text-sm md:text-base col-span-1">
50 {{ .Trigger.Kind.String }}
51 </div>
52
53 <div class="col-span-2 md:col-span-7 flex items-center gap-4">
54 {{ $target := .Trigger.TargetRef }}
55 {{ $workflows := .Workflows }}
56 {{ $link := "" }}
57 {{ if .IsResponding }}
58 {{ $link = printf "/%s/pipelines/%s/workflow/%d" $root.RepoInfo.FullName .Id (index $workflows 0) }}
59 {{ end }}
60 {{ if .Trigger.IsPush }}
61 <span class="font-bold">{{ $target }}</span>
62 <span class="hidden md:inline-flex gap-2 items-center font-mono text-sm">
63 {{ $old := deref .Trigger.PushOldSha }}
64 {{ $new := deref .Trigger.PushNewSha }}
65
66 <a href="/{{ $root.RepoInfo.FullName }}/commit/{{ $new }}">{{ slice $new 0 8 }}</a>
67 {{ i "arrow-left" "size-4" }}
68 <a href="/{{ $root.RepoInfo.FullName }}/commit/{{ $old }}">{{ slice $old 0 8 }}</a>
69 </span>
70 {{ else if .Trigger.IsPullRequest }}
71 {{ $sha := deref .Trigger.PRSourceSha }}
72 <span class="inline-flex gap-2 items-center">
73 <span class="font-bold">{{ $target }}</span>
74 {{ i "arrow-left" "size-4" }}
75 {{ .Trigger.PRSourceBranch }}
76 <span class="text-sm font-mono">
77 @
78 <a href="/{{ $root.RepoInfo.FullName }}/commit/{{ $sha }}">{{ slice $sha 0 8 }}</a>
79 </span>
80 </span>
81 {{ end }}
82 </div>
83
84 <div class="text-sm md:text-base col-span-1">
85 {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" . "RepoInfo" $root.RepoInfo) }}
86 </div>
87
88 <div class="text-sm md:text-base col-span-1 text-right">
89 {{ template "repo/fragments/shortTimeAgo" .Created }}
90 </div>
91
92 {{ $t := .TimeTaken }}
93 <div class="text-sm md:text-base col-span-1 text-right">
94 {{ if $t }}
95 <time title="{{ $t }}">{{ $t | durationFmt }}</time>
96 {{ else }}
97 <time>--</time>
98 {{ end }}
99 </div>
100
101 <div class="col-span-1 flex justify-end">
102 {{ if $link }}
103 <a class="md:hidden" href="/{{ $root.RepoInfo.FullName }}/pipelines/{{ .Id }}/workflow/{{ index $workflows 0 }}">
104 {{ i "arrow-up-right" "size-4" }}
105 </a>
106 <a class="hidden md:inline underline" href="/{{ $root.RepoInfo.FullName }}/pipelines/{{ .Id }}/workflow/{{ index $workflows 0 }}">
107 view
108 </a>
109 {{ end }}
110 </div>
111
112 </div>
113 {{ end }}
114{{ end }}