feat: display detailed action run diagnostics #9966

Merged
mfenniak merged 4 commits from aahlenst/forgejo:action-run-diagnostics into forgejo 2025-11-11 04:39:11 +01:00
Member

Forgejo Actions allows variables in jobs.<job_id>.runs-on. However, the action list skips checking whether a suitable runner is available if an expression contains variables. That hampers a user's ability to figure out whether an expression was evaluated correctly and why a job might not be picked up by an available runner.

This PR adds the ability to surface more complex and additional diagnostic information on the action view screen. Previously, only a job's status (waiting, running, ...) was displayed. Now, extended messages like "Waiting for a runner with the following labels: docker, trixie" are displayed with the possibility to show multiple messages simultaneously.

How it looked before:

old

How it looks after updating Forgejo without reloading the window:

old-after-update

How it looks afterwards with a single label:

new-single-label

How it looks afterwards with multiple labels:

new-multiple-labels

Checklist

The contributor guide contains information that will be helpful to first time contributors. There also are a few conditions for merging Pull Requests in Forgejo repositories. You are also welcome to join the Forgejo development chatroom.

Tests

  • I added test coverage for Go changes...
    • in their respective *_test.go for unit tests.
    • in the tests/integration directory if it involves interactions with a live Forgejo server.
  • I added test coverage for JavaScript changes...

Documentation

  • I created a pull request to the documentation to explain to Forgejo users how to use this change.
  • I did not document these changes and I do not expect someone else to do it.

Release notes

  • I do not want this change to show in the release notes.
  • I want the title to show in the release notes with a link to this pull request.
  • I want the content of the release-notes/<pull request number>.md to be be used for the release notes instead of the title.

Release notes

  • Features
    • PR: display detailed action run diagnostics
Forgejo Actions allows variables in `jobs.<job_id>.runs-on`. However, the action list [skips checking whether a suitable runner](https://codeberg.org/forgejo/forgejo/src/commit/c3412d0579acfc702224f1785fc44e5695daee90/routers/web/repo/actions/actions.go#L114-L148) is available if an expression contains variables. That hampers a user's ability to figure out whether an expression was evaluated correctly and why a job might not be picked up by an available runner. This PR adds the ability to surface more complex and additional diagnostic information on the action view screen. Previously, only a job's status (waiting, running, ...) was displayed. Now, extended messages like "Waiting for a runner with the following labels: docker, trixie" are displayed with the possibility to show multiple messages simultaneously. How it looked before: ![old](/attachments/019e4e83-d44e-4143-8df0-7fceb611a3bd) How it looks after updating Forgejo without reloading the window: ![old-after-update](/attachments/e909af81-cf9e-4f44-a011-75585a2d1950) How it looks afterwards with a single label: ![new-single-label](/attachments/72f4a862-e23d-4ab5-9f96-09545954f982) How it looks afterwards with multiple labels: ![new-multiple-labels](/attachments/53036d7b-3589-4eeb-bad1-4da4cd5ff4b5) ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [x] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] I do not want this change to show in the release notes. - [ ] I want the title to show in the release notes with a link to this pull request. - [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title. <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - Features - [PR](https://codeberg.org/forgejo/forgejo/pulls/9966): <!--number 9966 --><!--line 0 --><!--description ZGlzcGxheSBkZXRhaWxlZCBhY3Rpb24gcnVuIGRpYWdub3N0aWNz-->display detailed action run diagnostics<!--description--> <!--end release-notes-assistant-->
mfenniak left a comment
Member

I think this looks great. Please review the attached comments and update the PR description to include screenshots of the new feature and the standard PR template.

I think this looks great. Please review the attached comments and update the PR description to include screenshots of the new feature and the standard PR template.
@ -232,0 +240,4 @@
switch job.Status {
case StatusWaiting:
diagnostics = append(diagnostics, lang.TrString("actions.status.diagnostics.waiting", strings.Join(job.RunsOn, ", ")))
Member

Should use TrPluralString to allow proper pluralization of the translation string based upon how many entries are in job.RunsOn.

Should use `TrPluralString` to allow proper pluralization of the translation string based upon how many entries are in `job.RunsOn`.
mfenniak marked this conversation as resolved
@ -232,0 +245,4 @@
diagnostics = append(diagnostics, job.Status.LocaleString(lang))
}
if job.Run.NeedApproval {
Member

With the merge of #9397, I've performed a static review and it seems that checking NeedApproval will still work correctly for this check -- but a rebase and verification is worthwhile.

With the merge of #9397, I've performed a static review and it seems that checking `NeedApproval` will still work correctly for this check -- but a rebase and verification is worthwhile.
Author
Member

There's a unit test that covers that the message is generated if job.Run.NeedApproval is set.

There's a unit test that covers that the message is generated if `job.Run.NeedApproval` is set.
mfenniak marked this conversation as resolved
@ -3746,6 +3746,8 @@ status.cancelled = Canceled
status.skipped = Skipped
status.blocked = Blocked
status.diagnostics.waiting = Waiting for a runner with the following labels: %s
Member
  • New localization strings should be placed in locale_en-US.json
  • With the use of TrPluralString (noted in another comment) we could fix the pluralization here so that it isn't always "labels" when it might be singular ("label").
- New localization strings should be placed in `locale_en-US.json` - With the use of `TrPluralString` (noted in another comment) we could fix the pluralization here so that it isn't always "labels" when it might be singular ("label").
mfenniak marked this conversation as resolved
@ -184,3 +184,3 @@
type ViewCurrentJob struct {
Title string `json:"title"`
Detail string `json:"detail"`
Details []string `json:"details"`
Member

I'm thinking about what will happen when someone has the Forgejo UI open viewing an action run, and Forgejo is upgraded to include this new feature. The next API call to poll will get the value details and the value detail will be absent. The older version of the JS will continue to run until the page is reloaded, and I believe it will likely work with no errors -- although it won't have the detail field anymore, it will just change the rendering of {{ currentJob.detail }} to possibly display undefined.

If you agree with that assessment that there's no major problem caused during an upgrade, then we can resolve this comment.

I'm thinking about what will happen when someone has the Forgejo UI open viewing an action run, and Forgejo is upgraded to include this new feature. The next API call to poll will get the value `details` and the value `detail` will be absent. The older version of the JS will continue to run until the page is reloaded, and I believe it will likely work with no errors -- although it won't have the `detail` field anymore, it will just change the rendering of `{{ currentJob.detail }}` to possibly display undefined. If you agree with that assessment that there's no major problem caused during an upgrade, then we can resolve this comment.
Author
Member

There's now a screenshot above that shows what's going to happen.

There's now a screenshot above that shows what's going to happen.
mfenniak marked this conversation as resolved
aahlenst force-pushed action-run-diagnostics from 913f9e6cbd
Some checks failed
testing / frontend-checks (pull_request) Successful in 2m2s
testing / backend-checks (pull_request) Successful in 3m31s
testing / test-e2e (pull_request) Failing after 6m41s
testing / test-unit (pull_request) Successful in 7m49s
testing / test-remote-cacher (redis) (pull_request) Successful in 1m50s
testing / test-remote-cacher (valkey) (pull_request) Successful in 1m52s
testing / test-remote-cacher (garnet) (pull_request) Successful in 1m40s
testing / test-remote-cacher (redict) (pull_request) Successful in 1m40s
testing / test-mysql (pull_request) Successful in 24m14s
testing / test-sqlite (pull_request) Successful in 29m44s
testing / test-pgsql (pull_request) Successful in 35m12s
testing / security-check (pull_request) Successful in 1m3s
issue-labels / backporting (pull_request_target) Has been skipped
issue-labels / cascade (pull_request_target) Has been skipped
requirements / merge-conditions (pull_request) Successful in 4s
issue-labels / release-notes (pull_request_target) Has been skipped
to 09fe488363
All checks were successful
issue-labels / backporting (pull_request_target) Has been skipped
issue-labels / cascade (pull_request_target) Has been skipped
requirements / merge-conditions (pull_request) Successful in 1s
issue-labels / release-notes (pull_request_target) Successful in 31s
2025-11-10 22:32:42 +01:00
Compare
@ -181,2 +181,4 @@
"other": "%s downloads"
},
"actions.status.diagnostics.waiting": {
"one": "Waiting for a runner with the following label: %s",
Author
Member

It seems I cannot specify a message for the "zero" case. That is only accepted in some other languages.

It seems I cannot specify a message for the "zero" case. That is only accepted in some other languages.
mfenniak marked this conversation as resolved
Author
Member

It's now using TrPluralString and I also made a rebase. I've added a couple of screenshots.

It's now using `TrPluralString` and I also made a rebase. I've added a couple of screenshots.
mfenniak approved these changes 2025-11-11 02:35:15 +01:00
Where does that come from? The following is a preview of the release notes for this pull request, as they will appear in the upcoming release. They are derived from the content of the `release-notes/9966.md` file, if it exists, or the title of the pull request. They were also added at the bottom of the description of this pull request for easier reference.

This message and the release notes originate from a call to the release-notes-assistant.

@@ -42,2 +42,10 @@
 - [ ] I want the title to show in the release notes with a link to this pull request.
 - [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.
+
+<!--start release-notes-assistant-->
+
+## Release notes
+<!--URL:https://codeberg.org/forgejo/forgejo-->
+- Features
+  - [PR](https://codeberg.org/forgejo/forgejo/pulls/9966): <!--number 9966 --><!--line 0 --><!--description ZGlzcGxheSBkZXRhaWxlZCBhY3Rpb24gcnVuIGRpYWdub3N0aWNz-->display detailed action run diagnostics<!--description-->
+<!--end release-notes-assistant-->

Release notes

  • Features
    • PR: display detailed action run diagnostics
<details> <summary>Where does that come from?</summary> The following is a preview of the release notes for this pull request, as they will appear in the upcoming release. They are derived from the content of the `release-notes/9966.md` file, if it exists, or the title of the pull request. They were also added at the bottom of the description of this pull request for easier reference. This message and the release notes originate from a call to the [release-notes-assistant](https://code.forgejo.org/forgejo/release-notes-assistant). ```diff @@ -42,2 +42,10 @@ - [ ] I want the title to show in the release notes with a link to this pull request. - [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title. + +<!--start release-notes-assistant--> + +## Release notes +<!--URL:https://codeberg.org/forgejo/forgejo--> +- Features + - [PR](https://codeberg.org/forgejo/forgejo/pulls/9966): <!--number 9966 --><!--line 0 --><!--description ZGlzcGxheSBkZXRhaWxlZCBhY3Rpb24gcnVuIGRpYWdub3N0aWNz-->display detailed action run diagnostics<!--description--> +<!--end release-notes-assistant--> ``` </details> <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - Features - [PR](https://codeberg.org/forgejo/forgejo/pulls/9966): <!--number 9966 --><!--line 0 --><!--description ZGlzcGxheSBkZXRhaWxlZCBhY3Rpb24gcnVuIGRpYWdub3N0aWNz-->display detailed action run diagnostics<!--description--> <!--end release-notes-assistant-->
Member

For some reason CI hasn't started on the last force push; I'm going to do an "Update branch by merge" to generate a new commit.

For some reason CI hasn't started on the last force push; I'm going to do an "Update branch by merge" to generate a new commit.
Merge branch 'forgejo' into action-run-diagnostics
Some checks failed
requirements / merge-conditions (pull_request) Successful in 2s
issue-labels / release-notes (pull_request_target) Successful in 44s
testing / frontend-checks (pull_request) Successful in 1m44s
testing / backend-checks (pull_request) Successful in 4m1s
testing / test-unit (pull_request) Successful in 9m22s
testing / test-e2e (pull_request) Failing after 13m15s
testing / test-remote-cacher (redis) (pull_request) Successful in 2m24s
testing / test-remote-cacher (valkey) (pull_request) Successful in 2m31s
testing / test-remote-cacher (garnet) (pull_request) Successful in 2m29s
testing / test-remote-cacher (redict) (pull_request) Successful in 2m23s
testing / test-mysql (pull_request) Successful in 26m34s
testing / test-sqlite (pull_request) Successful in 29m13s
testing / test-pgsql (pull_request) Successful in 34m30s
testing / security-check (pull_request) Successful in 45s
issue-labels / backporting (pull_request_target) Has been skipped
milestone / set (pull_request_target) Successful in 4s
53bb967e55
mfenniak merged commit 72b35c5a73 into forgejo 2025-11-11 04:39:11 +01:00
Sign in to join this conversation.
No reviewers
No labels
arch
riscv64
backport/v1.19
backport/v1.20
backport/v1.21/forgejo
backport/v10.0/forgejo
backport/v11.0/forgejo
backport/v12.0/forgejo
backport/v13.0/forgejo
backport/v14.0/forgejo
backport/v7.0/forgejo
backport/v8.0/forgejo
backport/v9.0/forgejo
breaking
bug
bug
confirmed
bug
duplicate
bug
needs-more-info
bug
new-report
bug
reported-upstream
code/actions
code/api
code/auth
code/auth/faidp
code/auth/farp
code/email
code/federation
code/git
code/migrations
code/packages
code/wiki
database
MySQL
database
PostgreSQL
database
SQLite
dependency-upgrade
dependency
certmagic
dependency
chart.js
dependency
Chi
dependency
Chroma
dependency
citation.js
dependency
codespell
dependency
css-loader
dependency
devcontainers
dependency
dropzone
dependency
editorconfig-checker
dependency
elasticsearch
dependency
enmime
dependency
F3
dependency
ForgeFed
dependency
garage
dependency
Git
dependency
git-backporting
dependency
Gitea
dependency
gitignore
dependency
go-ap
dependency
go-enry
dependency
go-gitlab
dependency
Go-org
dependency
go-rpmutils
dependency
go-sql-driver mysql
dependency
go-swagger
dependency
go-version
dependency
go-webauthn
dependency
gocron
dependency
Golang
dependency
goldmark
dependency
goquery
dependency
Goth
dependency
grpc-go
dependency
happy-dom
dependency
Helm
dependency
image-spec
dependency
jsonschema
dependency
KaTeX
dependency
lint
dependency
MariaDB
dependency
Mermaid
dependency
minio-go
dependency
misspell
dependency
Monaco
dependency
PDFobject
dependency
playwright
dependency
postcss
dependency
postcss-plugins
dependency
pprof
dependency
prometheus client_golang
dependency
protobuf
dependency
relative-time-element
dependency
renovate
dependency
reply
dependency
ssh
dependency
swagger-ui
dependency
tailwind
dependency
temporal-polyfill
dependency
terminal-to-html
dependency
tests-only
dependency
text-expander-element
dependency
urfave
dependency
vfsgen
dependency
vite
dependency
Woodpecker CI
dependency
x tools
dependency
XORM
Discussion
duplicate
enhancement/feature
forgejo/accessibility
forgejo/branding
forgejo/ci
forgejo/commit-graph
forgejo/documentation
forgejo/furnace cleanup
forgejo/i18n
forgejo/interop
forgejo/moderation
forgejo/privacy
forgejo/release
forgejo/scaling
forgejo/security
forgejo/ui
Gain
High
Gain
Nice to have
Gain
Undefined
Gain
Very High
good first issue
i18n/backport-stable
impact
large
impact
medium
impact
small
impact
unknown
Incompatible license
issue
closed
issue
do-not-exist-yet
issue
open
manual test
Manually tested during feature freeze
OS
FreeBSD
OS
Linux
OS
macOS
OS
Windows
problem
QA
regression
release blocker
Release Cycle
Feature Freeze
release-blocker
v7.0
release-blocker
v7.0.1
release-blocker
v7.0.2
release-blocker
v7.0.3
release-blocker
v7.0.4
release-blocker
v8.0.0
release-blocker/v9.0.0
run-all-playwright-tests
run-end-to-end-tests
test
manual
test
needed
test
needs-help
test
not-needed
test
present
untested
User research - time-tracker
valuable code
worth a release-note
User research - Accessibility
User research - Blocked
User research - Community
User research - Config (instance)
User research - Errors
User research - Filters
User research - Future backlog
User research - Git workflow
User research - Labels
User research - Moderation
User research - Needs input
User research - Notifications/Dashboard
User research - Rendering
User research - Repo creation
User research - Repo units
User research - Security
User research - Settings (in-app)
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/forgejo!9966
No description provided.