| 1 | {{ define "page" -}} |
| 2 | {{ template "repo-header" . }} |
| 3 | <section class="shithub-actions-page"> |
| 4 | {{ template "actions-sidebar" . }} |
| 5 | |
| 6 | <div class="shithub-actions-main"> |
| 7 | <header class="shithub-actions-head"> |
| 8 | <div> |
| 9 | <h1>{{ if .ActiveWorkflowName }}{{ .ActiveWorkflowName }}{{ else }}All workflows{{ end }}</h1> |
| 10 | <p>{{ .Pagination.ResultText }}</p> |
| 11 | </div> |
| 12 | <div class="shithub-actions-head-actions"> |
| 13 | {{ if .DispatchWorkflows }} |
| 14 | <details class="shithub-actions-dispatch"> |
| 15 | <summary class="shithub-button">{{ octicon "play" }} Run workflow</summary> |
| 16 | <div class="shithub-actions-dispatch-menu"> |
| 17 | {{ range .DispatchWorkflows }} |
| 18 | <form method="POST" action="{{ .DispatchHref }}" class="shithub-actions-dispatch-form"> |
| 19 | <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 20 | <header> |
| 21 | <h2>{{ .Name }}</h2> |
| 22 | <code>{{ .File }}</code> |
| 23 | </header> |
| 24 | <label> |
| 25 | <span>Branch</span> |
| 26 | <input type="text" name="ref" value="{{ $.Repo.DefaultBranch }}" required> |
| 27 | </label> |
| 28 | {{ range .Inputs }} |
| 29 | <label> |
| 30 | <span>{{ .Name }}{{ if .Required }} <strong>*</strong>{{ end }}</span> |
| 31 | {{ if .Description }}<small>{{ .Description }}</small>{{ end }} |
| 32 | {{ if .IsChoice }} |
| 33 | <select name="inputs.{{ .Name }}"{{ if .Required }} required{{ end }}> |
| 34 | {{ if not .Required }}<option value=""></option>{{ end }} |
| 35 | {{ range .Options }}<option value="{{ .Value }}"{{ if .Selected }} selected{{ end }}>{{ .Value }}</option>{{ end }} |
| 36 | </select> |
| 37 | {{ else if .IsBoolean }} |
| 38 | <span class="shithub-actions-dispatch-check"> |
| 39 | <input type="hidden" name="inputs.{{ .Name }}" value="false"> |
| 40 | <input type="checkbox" name="inputs.{{ .Name }}" value="true"{{ if eq .Default "true" }} checked{{ end }}> |
| 41 | </span> |
| 42 | {{ else }} |
| 43 | <input type="text" name="inputs.{{ .Name }}" value="{{ .Default }}"{{ if .Required }} required{{ end }}> |
| 44 | {{ end }} |
| 45 | </label> |
| 46 | {{ end }} |
| 47 | <button type="submit" class="shithub-button shithub-button-primary">{{ octicon "play" }} Run</button> |
| 48 | </form> |
| 49 | {{ end }} |
| 50 | </div> |
| 51 | </details> |
| 52 | {{ end }} |
| 53 | </div> |
| 54 | </header> |
| 55 | |
| 56 | <form class="shithub-actions-filters" method="GET" action="/{{ .Owner }}/{{ .Repo.Name }}/actions" aria-label="Workflow run filters"> |
| 57 | {{ if .Filters.Workflow }}<input type="hidden" name="workflow" value="{{ .Filters.Workflow }}">{{ end }} |
| 58 | <label class="shithub-actions-search"> |
| 59 | {{ octicon "git-branch" }} |
| 60 | <span class="sr-only">Branch</span> |
| 61 | <input type="search" name="branch" value="{{ .Filters.Branch }}" placeholder="Branch"> |
| 62 | </label> |
| 63 | <label class="shithub-actions-select"> |
| 64 | <span class="sr-only">Event</span> |
| 65 | <select name="event" aria-label="Event"> |
| 66 | {{ range .EventOptions }}<option value="{{ .Value }}"{{ if .Selected }} selected{{ end }}>{{ .Label }}</option>{{ end }} |
| 67 | </select> |
| 68 | </label> |
| 69 | <label class="shithub-actions-select"> |
| 70 | <span class="sr-only">Status</span> |
| 71 | <select name="status" aria-label="Status"> |
| 72 | {{ range .StatusOptions }}<option value="{{ .Value }}"{{ if .Selected }} selected{{ end }}>{{ .Label }}</option>{{ end }} |
| 73 | </select> |
| 74 | </label> |
| 75 | <label class="shithub-actions-select"> |
| 76 | <span class="sr-only">Conclusion</span> |
| 77 | <select name="conclusion" aria-label="Conclusion"> |
| 78 | {{ range .ConclusionOptions }}<option value="{{ .Value }}"{{ if .Selected }} selected{{ end }}>{{ .Label }}</option>{{ end }} |
| 79 | </select> |
| 80 | </label> |
| 81 | <label class="shithub-actions-search shithub-actions-actor-filter"> |
| 82 | {{ octicon "person" }} |
| 83 | <span class="sr-only">Actor</span> |
| 84 | <input type="search" name="actor" value="{{ .Filters.Actor }}" placeholder="Actor"> |
| 85 | </label> |
| 86 | <button type="submit" class="shithub-button">{{ octicon "search" }} Filter</button> |
| 87 | {{ if .Filters.HasAny }}<a class="shithub-button" href="/{{ .Owner }}/{{ .Repo.Name }}/actions">Clear</a>{{ end }} |
| 88 | </form> |
| 89 | |
| 90 | {{ if .Runs }} |
| 91 | <div class="shithub-actions-runs" aria-label="Workflow runs"> |
| 92 | {{ range .Runs }} |
| 93 | <article class="shithub-actions-run-row"> |
| 94 | <div class="shithub-actions-run-primary"> |
| 95 | <a href="{{ .Href }}" class="shithub-actions-run-title" aria-label="{{ .StateText }}: {{ .Title }}"> |
| 96 | <span class="shithub-actions-state shithub-actions-state-{{ .StateClass }}">{{ octicon .StateIcon }}</span> |
| 97 | <span>{{ .Title }}</span> |
| 98 | </a> |
| 99 | <p> |
| 100 | <strong>#{{ .RunIndex }}</strong> |
| 101 | triggered via {{ .EventLabel }} |
| 102 | {{ if .ActorUsername }}by <a href="/{{ .ActorUsername }}">{{ .ActorUsername }}</a>{{ end }} |
| 103 | for <a href="/{{ $.Owner }}/{{ $.Repo.Name }}/commit/{{ .HeadSha }}"><code>{{ .HeadShaShort }}</code></a> |
| 104 | </p> |
| 105 | </div> |
| 106 | <div class="shithub-actions-run-branch"> |
| 107 | {{ if .HeadRef }}<a class="shithub-branch-name" href="/{{ $.Owner }}/{{ $.Repo.Name }}/tree/{{ .HeadRef }}">{{ .HeadRef }}</a>{{ else }}<code>{{ .HeadShaShort }}</code>{{ end }} |
| 108 | </div> |
| 109 | <div class="shithub-actions-run-meta"> |
| 110 | <span>{{ octicon "calendar" }} <time datetime="{{ .UpdatedAt.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .UpdatedAt }}</time></span> |
| 111 | <span>{{ octicon "stopwatch" }} {{ .Duration }}</span> |
| 112 | <button type="button" class="shithub-icon-button" aria-label="Show run options">{{ octicon "kebab-horizontal" }}</button> |
| 113 | </div> |
| 114 | </article> |
| 115 | {{ end }} |
| 116 | </div> |
| 117 | <nav class="shithub-actions-pagination" aria-label="Workflow run pagination"> |
| 118 | <span>{{ .Pagination.ResultText }}</span> |
| 119 | <div> |
| 120 | {{ if .Pagination.HasPrev }}<a class="shithub-button" href="{{ .Pagination.PrevHref }}">Previous</a>{{ else }}<span class="shithub-button shithub-button-disabled" aria-disabled="true">Previous</span>{{ end }} |
| 121 | {{ if .Pagination.HasNext }}<a class="shithub-button" href="{{ .Pagination.NextHref }}">Next</a>{{ else }}<span class="shithub-button shithub-button-disabled" aria-disabled="true">Next</span>{{ end }} |
| 122 | </div> |
| 123 | </nav> |
| 124 | {{ else }} |
| 125 | <section class="shithub-actions-empty"> |
| 126 | <div class="shithub-actions-empty-icon">{{ octicon "play" }}</div> |
| 127 | <h2>{{ if .Filters.HasAny }}No workflow runs match these filters{{ else }}There are no workflow runs yet{{ end }}</h2> |
| 128 | <p>{{ if .Filters.HasAny }}Clear or adjust the filters to see other runs.{{ else }}Runs from `.shithub/workflows/*.yml` will appear here after a trigger enqueues them.{{ end }}</p> |
| 129 | </section> |
| 130 | {{ end }} |
| 131 | </div> |
| 132 | </section> |
| 133 | {{- end }} |