| 1 | {{ define "page" -}} |
| 2 | {{ template "repo-header" . }} |
| 3 | <section class="shithub-actions-run-page shithub-actions-log-page"> |
| 4 | <header class="shithub-actions-run-head"> |
| 5 | <div> |
| 6 | <a href="{{ .Log.BackHref }}" class="shithub-actions-back">{{ octicon "workflow" }} {{ .Log.Run.Title }} #{{ .Log.Run.RunIndex }}</a> |
| 7 | <h1> |
| 8 | <span class="shithub-actions-state shithub-actions-state-{{ .Log.Step.StateClass }}">{{ octicon .Log.Step.StateIcon }}</span> |
| 9 | {{ .Log.Step.Name }} |
| 10 | </h1> |
| 11 | <p> |
| 12 | {{ .Log.Job.Name }} · {{ .Log.Step.StateText }} · {{ .Log.Step.Duration }} |
| 13 | {{ if .Log.Step.LogByteCount }} · {{ .Log.Step.LogByteCount }} bytes{{ end }} |
| 14 | </p> |
| 15 | </div> |
| 16 | <div class="shithub-actions-run-head-actions"> |
| 17 | <a class="shithub-button" href="{{ .Log.BackHref }}">{{ octicon "list-unordered" }} Run</a> |
| 18 | {{ if .Log.DownloadURL }}<a class="shithub-button" href="{{ .Log.DownloadURL }}">{{ octicon "download" }} Download</a>{{ end }} |
| 19 | </div> |
| 20 | </header> |
| 21 | |
| 22 | <div class="shithub-actions-run-layout"> |
| 23 | <aside class="shithub-actions-sidebar shithub-actions-run-sidebar" aria-label="Run navigation"> |
| 24 | <a href="{{ .Log.BackHref }}" class="shithub-actions-nav-item">{{ octicon "home" }} <span>Summary</span></a> |
| 25 | <div class="shithub-actions-sidebar-section"> |
| 26 | <h2>Steps</h2> |
| 27 | {{ range .Log.Job.Steps }} |
| 28 | <a href="{{ .LogHref }}" class="shithub-actions-nav-item{{ if eq .StepIndex $.Log.Step.StepIndex }} is-active{{ end }}"{{ if eq .StepIndex $.Log.Step.StepIndex }} aria-current="page"{{ end }}> |
| 29 | <span class="shithub-actions-state shithub-actions-state-{{ .StateClass }}">{{ octicon .StateIcon }}</span> |
| 30 | <span>{{ .Name }}</span> |
| 31 | </a> |
| 32 | {{ end }} |
| 33 | </div> |
| 34 | </aside> |
| 35 | |
| 36 | <div class="shithub-actions-run-main"> |
| 37 | <section class="shithub-actions-log-panel"> |
| 38 | <header> |
| 39 | <div> |
| 40 | <h2>{{ .Log.Step.Name }}</h2> |
| 41 | <p>{{ .Log.LogSource }}{{ if .Log.LogTruncated }} · truncated to 1 MiB{{ end }}</p> |
| 42 | </div> |
| 43 | </header> |
| 44 | {{ if .Log.LogError }} |
| 45 | <p class="shithub-actions-log-empty">{{ .Log.LogError }}</p> |
| 46 | {{ else if .Log.StreamHref }} |
| 47 | <pre class="shithub-actions-log-output"><code data-actions-log-stream="{{ .Log.StreamHref }}">{{ .Log.LogText }}</code></pre> |
| 48 | <p class="shithub-actions-log-live" data-actions-log-status>Live</p> |
| 49 | {{ else if .Log.LogText }} |
| 50 | <pre class="shithub-actions-log-output"><code>{{ .Log.LogText }}</code></pre> |
| 51 | {{ else }} |
| 52 | <p class="shithub-actions-log-empty">No log output has been recorded for this step.</p> |
| 53 | {{ end }} |
| 54 | </section> |
| 55 | </div> |
| 56 | </div> |
| 57 | </section> |
| 58 | {{ if .Log.StreamHref }} |
| 59 | <script> |
| 60 | (() => { |
| 61 | const code = document.querySelector("[data-actions-log-stream]"); |
| 62 | if (!code || !window.EventSource) return; |
| 63 | const status = document.querySelector("[data-actions-log-status]"); |
| 64 | const scroller = code.closest(".shithub-actions-log-output"); |
| 65 | const decoder = new TextDecoder(); |
| 66 | const stream = new EventSource(code.dataset.actionsLogStream); |
| 67 | const scrollToBottom = () => { |
| 68 | if (scroller) scroller.scrollTop = scroller.scrollHeight; |
| 69 | }; |
| 70 | stream.addEventListener("chunk", (event) => { |
| 71 | try { |
| 72 | const message = JSON.parse(event.data); |
| 73 | const raw = atob(message.chunk_b64 || ""); |
| 74 | const bytes = Uint8Array.from(raw, (char) => char.charCodeAt(0)); |
| 75 | code.textContent += decoder.decode(bytes, { stream: true }); |
| 76 | scrollToBottom(); |
| 77 | } catch { |
| 78 | if (status) status.textContent = "Live log interrupted"; |
| 79 | } |
| 80 | }); |
| 81 | stream.addEventListener("done", () => { |
| 82 | stream.close(); |
| 83 | if (status) status.textContent = "Log complete"; |
| 84 | window.setTimeout(() => window.location.reload(), 600); |
| 85 | }); |
| 86 | stream.onerror = () => { |
| 87 | if (status) status.textContent = "Reconnecting"; |
| 88 | }; |
| 89 | scrollToBottom(); |
| 90 | })(); |
| 91 | </script> |
| 92 | {{ end }} |
| 93 | {{- end }} |