Skip to content

Align actions status icons and texts with GitHub#37206

Open
silverwind wants to merge 19 commits intogo-gitea:mainfrom
silverwind:acticons
Open

Align actions status icons and texts with GitHub#37206
silverwind wants to merge 19 commits intogo-gitea:mainfrom
silverwind:acticons

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Apr 14, 2026

Action workflows have 8 statuses but the UI only showed 5 (from the commit status api). The three action statuses were always static yellow dot. Align all 8 to GitHub as closely as possible:

  • waiting — octicon-circle (hollow circle), gray
  • blocked — octicon-blocked (slashed circle), yellow
  • running — gitea-running (rotating spinner), yellow
  • cancelled — octicon-stop (gray), was octicon-x (red)

Descriptions also aligned with GitHub:

  • "Has started running" → "In progress"
  • "Has been cancelled" → "Cancelled after {dur}"
  • "Has been skipped" → "Skipped"
Screenshot 2026-04-23 at 11 29 26

This PR was written with the help of Claude Opus 4.7.

The PR merge-box tooltip collapsed Actions waiting/blocked/running into a
single yellow-dot icon because `CommitStatus.State` maps all three to
`CommitStatusPending` and the `createCommitStatus` dedup is keyed only on
`State`. Transitions among the three also left the stored `Description`
frozen at whichever was written first.

Fix by enriching the loaded `CommitStatus` rows with the live
`ActionRunJob.Status`:

- Add transient `CommitStatus.ActionStatus actions_model.Status` (xorm:"-")
- Add `LoadActionStatuses` enricher (one batched IN query)
- `GetDescription` method overrides `.Description` for waiting/blocked/running
- Call the enricher at every CommitStatus tooltip render site (merge box,
  PR list, commit list, branch list, release list, Diff view, file viewer)
- External CI statuses don't set an Actions TargetURL, so `ActionStatus`
  stays zero and the template falls through to the existing
  `repo/commit_status` icons — no external-vs-Actions branch needed
- `templates/repo/icons/action_status.tmpl` consolidated with a `fill`
  param: `true` for filled-circle icons (Actions UI / runs list),
  omitted for bare icons matching `repo/commit_status` (merge box)
- Delete `templates/repo/actions/status.tmpl`; sole caller inlines
  the tooltip span

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 14, 2026
@silverwind silverwind changed the title Rework actions status icons Rework actions status icons and text Apr 14, 2026
Matches the ongoing-state phrasing in both createCommitStatus (stored
value) and GetDescription (live override).

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI doesn't know how to make the code maintainable.

There are a lot of "LoadActionStatuses" calls now.

ActionStatus should not be added to the model. Only prepare it as a separate template value or function when it is needed.

@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 14, 2026
Copy link
Copy Markdown
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the design is completely wrong.

Commit status can come from woodpecker (update: the IsUnknown branch handles it), or by API (e.g.: commit status is changed by API call from "warning" to "success"). If the commit status is "success", then it must be displayed as "success", no matter what Actions status is.

@wxiaoguang wxiaoguang marked this pull request as draft April 14, 2026 05:42
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Apr 14, 2026

Commit status can come from woodpecker (update: the IsUnknown branch handles it), or by API (e.g.: commit status is changed by API call from "warning" to "success"). If the commit status is "success", then it must be displayed as "success", no matter what Actions status is.

The commit status renders like before, same 5 statuses, completely unaffected. Only actions sets the additional statuses added via LoadActionStatuses.

I agree the littering of LoadActionStatuses is not ideal, maybe there is a common place to do it. I'm working under the restriction that not all places in the UI should show action status, e.g. if the icon is for a commit, only show commit status, only if it's for action workflows, show the enriched action status with the 8 states.

@a1012112796
Copy link
Copy Markdown
Member

I think add some new frature like github checks which provide more status and more params than commit status is a better solution.

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Apr 16, 2026

I think add some new frature like github checks which provide more status and more params than commit status is a better solution.

Yes, GitHub distinguishes between:

  • commit status (5 statuses, same as gitea)
  • check_runs (at least 8 statuses)

Not sure if a full check_runs implementation is warranted currently. My goal is to just get the actions-specific statuses to render correctly on Gitea.

Reworks the previous attempt: instead of mutating
git_model.CommitStatus.ActionStatus from a LoadActionStatuses helper
called at every status-loading site, build a side map
services/actions.CommitStatusActionInfo (CommitStatus.ID → live
ActionRunJob status) and stash it in ctx.Data for templates to read
via ctx.RootData. The model no longer imports actions_model.

Only pending CommitStatus rows backed by Gitea Actions are enriched —
non-pending state from any CI source (Woodpecker, API-set, …) is
trusted as-is, addressing the "if commit status is success it must
display as success" review note.

Adds PrepareCommitStatusesUI / PrepareCommitStatusesMapUI helpers that
fold the existing CanRead(unit.TypeActions) → HideActionsURL pattern
together with the new enrichment so each route's status-loading site
reduces to one call. Mirrors the established
CommitStatusesHideActionsURL precedent.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member Author

All feedback addressed, commit description updated and simplified.

@silverwind silverwind marked this pull request as ready for review April 19, 2026 22:24
silverwind and others added 3 commits April 20, 2026 00:24
Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Sibling of action_status; both render a single status icon.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Apr 20, 2026

Also, "cancelled" has a wrong "X" icon, not matching GitHub.

Gitea:

image

GitHub:

image

Will fix that icon here as well and likely adjust the text. Ideally do a full pass over all statuses for correct icon and text.

@silverwind silverwind changed the title Rework actions status icons and text Align actions status icons and texts with GitHub Apr 21, 2026
@silverwind silverwind added the topic/gitea-actions related to the actions of Gitea label Apr 21, 2026
@silverwind silverwind added this to the 1.27.0 milestone Apr 21, 2026
- Cancelled jobs now render with octicon-stop (gray) instead of
  octicon-x (red). Achieved by broadening CommitStatusActionInfo to
  enrich all Gitea Actions rows, not just pending ones.
- Align descriptions with GitHub: "Cancelled after {dur}", "Skipped".
- PrepareCommitStatusesUI now enriches before hiding URLs so users
  without Actions read permission still see correct icons, and merges
  into ctx.Data across calls so multi-panel pages (PR view) render
  both panels correctly.
- Convert missed HideActionsURL sites in repo.go and issue_view.go to
  PrepareCommitStatusesUI; switch branch.go to the Map variant.
- Align `fill` default between Go template and Vue component (both
  default false); set explicitly at the filled callers.
- Add integration test covering all 8 action statuses end-to-end.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Apr 21, 2026

7c310e8 fixes the cancel status and adds parity with GitHub (except for statuses like "blocked" which don't exist on GitHub) and adds a full integration tests for all 8 statuses.

@silverwind silverwind added the type/enhancement An improvement of existing functionality label Apr 21, 2026
Fixes modernize lint error.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
silverwind and others added 8 commits April 23, 2026 09:55
* origin/main: (32 commits)
  fix: commit status reporting (go-gitea#37372)
  Support for Custom URI Schemes in OAuth2 Redirect URIs (go-gitea#37356)
  Fix cmd tests by mocking builtin paths (go-gitea#37369)
  chore: upgrade Go version in devcontainer image to 1.26 (go-gitea#37374)
  Fix button layout shift when collapsing file tree in editor (go-gitea#37363)
  Update `Block a user` form (go-gitea#37359)
  Remove IsValidExternalURL/IsAPIURL and use IsValidURL at call sites (go-gitea#37364)
  Add URL to `Learn more about blocking a user` (go-gitea#37355)
  fix: use TriggerEvent instead of Event in workflow runs API response for scheduled runs (go-gitea#37288)
  Add event.schedule context for schedule actions task (go-gitea#37320)
  Fix typos (go-gitea#37346)
  Fix an issue where changing an organization’s visibility caused problems when users had forked its repositories. (go-gitea#37324)
  Fail vite build on rolldown warnings via NODE_ENV=test (go-gitea#37270)
  Use modern "git update-index --cacheinfo" syntax to support more file names (go-gitea#37338)
  Fix URL related escaping for oauth2 (go-gitea#37334)
  When the requested arch rpm is missing fall back to noarch (go-gitea#37236)
  Fix `relative-time` error and improve global error handler (go-gitea#37241)
  Enhance styling in actions page (go-gitea#37323)
  fix(oauth): Error on auth sources with spaces (go-gitea#37327)
  Fix actions concurrency groups cross-branch leak (go-gitea#37311)
  ...

# Conflicts:
#	services/actions/commit_status.go
PrepareCommitStatusesUI now only enriches CommitStatusActionInfo; each
callsite restores the original CanRead + CommitStatusesHideActionsURL
block so the diff against main stays additive.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Extends TestActionsCommitStatusRunning with a commits-list page render to
confirm status.tmpl inside .tippy-target receives the live icon and
description. Every page using repo/commit_statuses.tmpl embeds this
tooltip, so coverage was previously only on the PR merge box.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
PrepareCommitStatusesUI / PrepareCommitStatusesMapUI required every
handler that loaded commit statuses to wire the enrichment into
ctx.Data. Replaced with a MiscUtils.ActionsCommitStatusInfo method on
the template context: repo/pulls/status.tmpl (rendered both in the PR
merge box and inside every repo/commit_statuses.tmpl tippy tooltip)
resolves the live ActionRunJob.Status itself.

CommitStatusActionInfo + GetCommitStatusActionInfo move to models/git
so the template helper lives in modules/templates without depending on
services/*. All 10 handler callsites and their actions_service imports
disappear.

Verified by TestActionsCommitStatusRunning (tooltip) and
TestActionsCommitStatusIcons (merge box).

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
- Relocate CommitStatusActionInfo + GetCommitStatusActionInfo from
  models/git (where it landed only to dodge an import cycle) to
  modules/actions/commitstatusinfo. That package joins models/git and
  models/actions and is where a reader looking for Actions-specific
  commit-status logic would expect to find it.
- Replace MiscUtils.ActionsCommitStatusInfo (which broke MiscUtils's
  implicit "pure, cheap" contract) with a dedicated ActionsUtils
  template type. Template helpers grouped by concern mirror the
  existing RenderUtils / AvatarUtils / MiscUtils pattern, and a
  separate namespace makes "this one touches the DB" explicit.

Template call is now `ctx.ActionsUtils.CommitStatusInfo .CommitStatuses`.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
- Rename subpackage commitstatusinfo -> statusinfo; types drop the
  redundant prefix (ActionInfo, GetActionInfo) so callers read as
  statusinfo.GetActionInfo instead of the previous stutter.
- Note the status.Repo side-effect in GetActionInfo's doc: ParseGiteaActionsTargetURL
  needs Repo loaded, and the RepoID cache avoids per-row lookups.
- Move the $actionInfo binding inside {{if .CommitStatus}} so pages
  without a status panel skip the DB query entirely.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
modules/actions/artifacts.go held HTTP-response orchestration
(ctx.Redirect, httplib.ServeUserContentByFile) via *services/context.Base,
which is a reverse-layer import from modules/ into services/. Move the
whole file verbatim into services/actions next to the rest of the
action service code. Callers (three router files) swap the import
target; no behavior change.

This also unblocks modules/actions from being imported by code higher
in the layer stack without cycling through services/context.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
modules/actions/statusinfo only existed to dodge the modules/actions ->
services/context leak from artifacts.go. With that file moved, the
subpackage is unneeded. Rename types to avoid stutter in their new
home: statusinfo.ActionInfo -> actions.CommitStatusInfo and
statusinfo.GetActionInfo -> actions.GetCommitStatusInfo.

Also tighten doc on util_actions.go's ActionsUtils (drop drift-prone
cross-file comparison and a duplicated rationale on the one-line
wrapper method).

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member Author

Code significantly cleaned up. The key commit is 6cb3859 which cleans up the file structure to avoid workaround regarding circular imports.

silverwind and others added 3 commits April 24, 2026 03:54
* origin/main:
  Allow fast-forward-only merge when signed commits are required (go-gitea#37335)
  Introduce `ActionRunAttempt` to represent each execution of a run (go-gitea#37119)
  Move review request functions to a standalone file (go-gitea#37358)
  Fix repo init README EOL (go-gitea#37388)
  Fix org team assignee/reviewer lookups for team member permissions (go-gitea#37365)
  Remove external service dependencies in migration tests (go-gitea#36866)
  Extend issue context popup beyond markdown content (go-gitea#36908)

# Conflicts:
#	routers/api/v1/repo/action.go
#	web_src/js/components/RepoActionView.vue
IconStatus is nil-map safe, so the $actionInfo guard and two-step
$actionStatus assignment collapse to a single call.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member Author

@wxiaoguang still blocking?

Comment on lines +1812 to +1814
// Verify GetCommitStatusInfo surfaces the live ActionRunJob.Status so the
// icon reflects Waiting/Running/Blocked — all three share State=Pending in the
// stored CommitStatus row.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very slow and fragile to test GetCommitStatusInfo via web page.

It should have its own unit test clearly.

* status: one of success, skipped, waiting, blocked, running, failure, cancelled, unknown
* size: icon size in pixels (default 16)
* className: additional CSS classes
* fill: use filled-circle icons for success/failure (default false: bare icons matching repo/commit_status)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think "fill" is a right prop name.

What you mean is "use filled (or some other concept: solid, opaque) icon, but not fill the icon's color"

It should be IconStyle='filled-circle' or or something.

{{/* Template Attributes:
* status: one of success, skipped, waiting, blocked, running, failure, cancelled, unknown
* size: icon size in pixels (default 16)
* className: additional CSS classes
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, all template variables are PascalCase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged topic/gitea-actions related to the actions of Gitea type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants