1
1
mirror of https://github.com/go-gitea/gitea synced 2025-12-06 21:08:25 +00:00
Files
gitea/templates/repo/actions/runs_list.tmpl
Zettat123 0d740a6a72 Improve online runner check (#35722)
This PR moves "no online runner" warning to the runs list. 

A job's `runs-on` may contain expressions like `runs-on: [self-hosted,
"${{ inputs.chosen-os }}"]` so the value of `runs-on` may be different
in each run. We cannot check it through the workflow file.

<details>
  <summary>Screenshots</summary>

Before:

<img width="960" alt="3d2a91746271d8b1f12c8f7d20eba550"
src="https://github.com/user-attachments/assets/7a972c50-db97-49d2-b12b-c1a439732a11"
/>

After:

<img width="960" alt="image"
src="https://github.com/user-attachments/assets/fc076e0e-bd08-4afe-99b9-c0eb0fd2c7e7"
/>
</details>

This PR also splits `prepareWorkflowDispatchTemplate` function into 2
functions:
- `prepareWorkflowTemplate` get and check all of the workflows
- `prepareWorkflowDispatchTemplate` only prepare workflow dispatch
config for `workflow_dispatch` workflows.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-24 12:02:52 -07:00

71 lines
2.8 KiB
Handlebars

<div class="flex-list run-list">
{{if not .Runs}}
<div class="empty-placeholder">
{{svg "octicon-no-entry" 48}}
<h2>{{if $.IsFiltered}}{{ctx.Locale.Tr "actions.runs.no_results"}}{{else}}{{ctx.Locale.Tr "actions.runs.no_runs"}}{{end}}</h2>
</div>
{{end}}
{{range $run := .Runs}}
<div class="flex-item tw-items-center">
<div class="flex-item-leading">
{{template "repo/actions/status" (dict "status" $run.Status.String)}}
</div>
<div class="flex-item-main">
<a class="flex-item-title" title="{{$run.Title}}" href="{{$run.Link}}">
{{or $run.Title (ctx.Locale.Tr "actions.runs.empty_commit_message")}}
</a>
<div class="flex-item-body">
<span><b>{{if not $.CurWorkflow}}{{$run.WorkflowID}} {{end}}#{{$run.Index}}</b>:</span>
{{- if $run.ScheduleID -}}
{{ctx.Locale.Tr "actions.runs.scheduled"}}
{{- else -}}
{{ctx.Locale.Tr "actions.runs.commit"}}
<a href="{{$.RepoLink}}/commit/{{$run.CommitSHA}}">{{ShortSha $run.CommitSHA}}</a>
{{ctx.Locale.Tr "actions.runs.pushed_by"}}
<a href="{{$run.TriggerUser.HomeLink}}">{{$run.TriggerUser.GetDisplayName}}</a>
{{- end -}}
{{$errMsg := index $.RunErrors $run.ID}}
{{if $errMsg}}
<span class="flex-text-inline" data-tooltip-content="{{$errMsg}}">
{{svg "octicon-alert" 16 "text red"}}
</span>
{{end}}
</div>
</div>
<div class="flex-item-trailing">
{{if $run.IsRefDeleted}}
<span class="ui label run-list-ref gt-ellipsis tw-line-through" data-tooltip-content="{{$run.RefTooltip}}">{{$run.PrettyRef}}</span>
{{else}}
<a class="ui label run-list-ref gt-ellipsis" href="{{$run.RefLink}}" data-tooltip-content="{{$run.RefTooltip}}">{{$run.PrettyRef}}</a>
{{end}}
<div class="run-list-item-right">
<div class="run-list-meta">{{svg "octicon-calendar" 16}}{{DateUtils.TimeSince $run.Updated}}</div>
<div class="run-list-meta">{{svg "octicon-stopwatch" 16}}{{$run.Duration}}</div>
</div>
<div class="ui dropdown jump tw-p-2">
{{svg "octicon-kebab-horizontal"}}
<div class="menu flex-items-menu">
<a class="item" href="{{$run.Link}}/workflow">{{svg "octicon-play"}}{{ctx.Locale.Tr "actions.runs.view_workflow_file"}}</a>
{{if and $.CanWriteRepoUnitActions (not $run.Status.IsDone)}}
<a class="item link-action" data-url="{{$run.Link}}/cancel">
{{svg "octicon-x"}}{{ctx.Locale.Tr "actions.runs.cancel"}}
</a>
{{end}}
{{if and $.CanWriteRepoUnitActions $run.Status.IsDone}}
<a class="item link-action"
data-url="{{$run.Link}}/delete"
data-modal-confirm="{{ctx.Locale.Tr "actions.runs.delete.description"}}"
>
{{svg "octicon-trash"}}{{ctx.Locale.Tr "actions.runs.delete"}}
</a>
{{end}}
</div>
</div>
</div>
</div>
{{end}}
</div>
{{template "base/paginate" .}}