-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
fix: align actions status icons and texts #37206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
silverwind
wants to merge
29
commits into
go-gitea:main
Choose a base branch
from
silverwind:acticons
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 19 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
6e35de7
Rework actions status icons
silverwind 9e266a6
Use "In progress" for StatusRunning description
silverwind 6716fca
Move action-status enrichment off the CommitStatus model
silverwind 1489ee0
Merge branch 'main' into acticons
silverwind c140daf
Shorten doc comments on CommitStatusActionInfo
silverwind 20c0ef8
Move commit_status template into icons/
silverwind 7c310e8
Fix cancelled icon and align action status UI with GitHub
silverwind 92e8974
Use maps.Copy for CommitStatusActionInfo merge
silverwind 1f03083
Merge remote-tracking branch 'origin/main' into acticons
silverwind f67c18f
Keep CanRead/HideActionsURL blocks at callsites
silverwind 264861b
Cover the commit-status tippy tooltip for in-flight action jobs
silverwind 5b83e49
Move action-status enrichment into a template-side lookup
silverwind e70ecdb
Move enrichment helper into its natural home
silverwind b0a485b
Tighten statusinfo package and template hook
silverwind 6cb3859
Move artifact-V4 download helpers into services/actions
silverwind d6cd40b
Collapse statusinfo subpackage into modules/actions
silverwind e9bb781
Merge remote-tracking branch 'origin/main' into acticons
silverwind c76ed0f
Simplify action-status lookup in pulls/status.tmpl
silverwind 561e690
Use maps.Keys for jobIDs collection
silverwind 59715a1
Address PR review feedback
silverwind bc99d63
Rename IconVariant to IconSuffix, drop ternary branching
silverwind 266f9bf
Merge branch 'main' into acticons
silverwind e4dc0c4
Merge branch 'main' into acticons
silverwind 95d29a7
Update templates/repo/icons/action_status.tmpl
wxiaoguang eddeb3f
Merge remote-tracking branch 'origin/main' into acticons
silverwind e83604f
Compute ActionInfo inside status_items.tmpl
silverwind 887b405
Compute ActionInfo only in the merge box, trim comments
silverwind e18443f
Replace integration test with focused unit test
silverwind 8d80fac
Pass icon-suffix to ActionRunStatus in attempt dropdown
silverwind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // Copyright 2026 The Gitea Authors. All rights reserved. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| package actions | ||
|
|
||
| import ( | ||
| "context" | ||
| "maps" | ||
| "slices" | ||
|
|
||
| actions_model "code.gitea.io/gitea/models/actions" | ||
| "code.gitea.io/gitea/models/db" | ||
| git_model "code.gitea.io/gitea/models/git" | ||
| repo_model "code.gitea.io/gitea/models/repo" | ||
| "code.gitea.io/gitea/modules/log" | ||
| ) | ||
|
|
||
| // CommitStatusInfo maps CommitStatus.ID to the live ActionRunJob status | ||
| // for Gitea Actions rows. | ||
| type CommitStatusInfo map[int64]actions_model.Status | ||
|
|
||
| // IconStatus returns the action status name to route the icon through | ||
| // repo/icons/action_status, or "" when the row isn't from Gitea Actions. | ||
| func (m CommitStatusInfo) IconStatus(s *git_model.CommitStatus) string { | ||
| if status, ok := m[s.ID]; ok { | ||
| return status.String() | ||
| } | ||
| return "" | ||
| } | ||
|
|
||
| // GetCommitStatusInfo resolves the live ActionRunJob.Status for every | ||
| // CommitStatus row backed by Gitea Actions. Rows from other sources (external | ||
| // CIs, API) are left untouched and rendered from their stored State. | ||
| // | ||
| // Side effect: fills in status.Repo for inputs whose Repo is nil, sharing one | ||
| // lookup across entries with the same RepoID — ParseGiteaActionsTargetURL | ||
| // needs Repo loaded and would otherwise lazy-load it per row. | ||
| func GetCommitStatusInfo(ctx context.Context, statuses []*git_model.CommitStatus) CommitStatusInfo { | ||
| if len(statuses) == 0 { | ||
| return nil | ||
| } | ||
| statusByJobID := make(map[int64]*git_model.CommitStatus) | ||
| repoByID := make(map[int64]*repo_model.Repository) | ||
| for _, status := range statuses { | ||
| if status == nil || status.TargetURL == "" { | ||
| continue | ||
| } | ||
| if status.Repo == nil { | ||
| status.Repo = repoByID[status.RepoID] | ||
| } | ||
| // ParseGiteaActionsTargetURL lazy-loads status.Repo on miss; cache the | ||
| // outcome so later entries with the same RepoID skip that load. | ||
| _, jobID, ok := status.ParseGiteaActionsTargetURL(ctx) | ||
| repoByID[status.RepoID] = status.Repo | ||
| if ok { | ||
| statusByJobID[jobID] = status | ||
| } | ||
| } | ||
| if len(statusByJobID) == 0 { | ||
| return nil | ||
| } | ||
| jobs := make(map[int64]*actions_model.ActionRunJob, len(statusByJobID)) | ||
| if err := db.GetEngine(ctx).In("id", slices.Collect(maps.Keys(statusByJobID))).Cols("id", "status").Find(&jobs); err != nil { | ||
| log.Error("GetCommitStatusInfo: find action run jobs: %v", err) | ||
| return nil | ||
| } | ||
| info := make(CommitStatusInfo, len(jobs)) | ||
| for jobID, status := range statusByJobID { | ||
| if job, ok := jobs[jobID]; ok && !job.Status.IsUnknown() { | ||
| info[status.ID] = job.Status | ||
| } | ||
| } | ||
| return info | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright 2026 The Gitea Authors. All rights reserved. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| package templates | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| git_model "code.gitea.io/gitea/models/git" | ||
| actions_module "code.gitea.io/gitea/modules/actions" | ||
| ) | ||
|
|
||
| // ActionsUtils groups template helpers for Gitea Actions data. Methods may | ||
| // issue DB queries. | ||
| type ActionsUtils struct { | ||
| ctx context.Context | ||
| } | ||
|
|
||
| func NewActionsUtils(ctx context.Context) *ActionsUtils { | ||
| return &ActionsUtils{ctx: ctx} | ||
| } | ||
|
|
||
| func (a *ActionsUtils) CommitStatusInfo(statuses []*git_model.CommitStatus) actions_module.CommitStatusInfo { | ||
| return actions_module.GetCommitStatusInfo(a.ctx, statuses) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.