Skip to content

feat(actions): add job summaries (GITHUB_STEP_SUMMARY)#37500

Draft
bircni wants to merge 2 commits intogo-gitea:mainfrom
bircni:feature/job-summary
Draft

feat(actions): add job summaries (GITHUB_STEP_SUMMARY)#37500
bircni wants to merge 2 commits intogo-gitea:mainfrom
bircni:feature/job-summary

Conversation

@bircni
Copy link
Copy Markdown
Member

@bircni bircni commented May 1, 2026

  • Add GitHub-style Actions job summaries support (GITHUB_STEP_SUMMARY / workflow/SUMMARY.md) and render them on the run Summary view.
  • Store uploaded summaries internally in the DB (not as downloadable artifacts).
  • Add runtime-token endpoint for runners to upload summaries:
    • PUT /api/actions_pipeline/_apis/pipelines/workflows/{run_id}/jobs/{job_id}/summary
  • Advertise support to runners via RunnerService.Declare response header:
    • X-Gitea-Actions-Capabilities: job-summary
  • Devtest: extend /devtest/repo-action-view/... to include mock jobSummaries for previewing UI rendering.

Compatibility

  • New Gitea + old runner: no summary upload → UI shows nothing (no behavior change)
  • New runner + old Gitea: capability not advertised → runner skips upload (no behavior change)

Fixes #23721
PR on gitea-runner https://gitea.com/gitea/runner/pulls/917

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 1, 2026
@bircni bircni force-pushed the feature/job-summary branch from 431a134 to 3e295ba Compare May 1, 2026 22:14
@bircni bircni marked this pull request as ready for review May 1, 2026 22:14
@lunny lunny added the type/enhancement An improvement of existing functionality label May 3, 2026
Comment thread routers/api/actions/artifacts.go
@lunny lunny added this to the 1.27.0 milestone May 3, 2026
@silverwind silverwind requested a review from Copilot May 4, 2026 18:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds GitHub-style Actions job summaries support by introducing a runner upload endpoint backed by a new DB table, then rendering uploaded summaries on the run “Summary” view in the web UI.

Changes:

  • Add ActionRunJobSummary model + migration, and expose job summaries in the Actions run view JSON.
  • Add runner-facing upload endpoint (PUT .../workflows/{run_id}/jobs/{job_id}/summary) and advertise capability via X-Gitea-Actions-Capabilities.
  • Render job summaries in the run Summary UI (plus devtest mock data) and extend integration coverage for the view response.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
web_src/js/modules/gitea-actions.ts Adds ActionsJobSummary type and jobSummaries field on ActionsRun.
web_src/js/components/RepoActionView.vue Adds a right-side “Job summaries” panel rendered via v-html; refactors right panel layout/styles.
web_src/js/components/ActionRunView.ts Initializes jobSummaries in the empty run state.
web_src/js/components/ActionRunSummaryView.vue Minor template/style whitespace adjustment.
tests/integration/actions_route_test.go Asserts job summaries are included in the run view response and contain rendered HTML.
routers/web/repo/actions/view.go Adds jobSummaries to the view response and renders stored content to HTML.
routers/web/devtest/mock_actions.go Adds mocked job summaries to devtest run view for UI preview.
routers/api/actions/runner/runner.go Adds capability negotiation header in RunnerService.Declare.
routers/api/actions/job_summary.go Implements job summary upload handler and (currently unused) router constructor.
routers/api/actions/artifacts.go Mounts the job summary upload endpoint under the Actions pipeline API prefix.
models/migrations/v1_27/v332.go Adds migration to create action_run_job_summary table.
models/migrations/migrations.go Registers migration ID 332.
models/actions/run_job_summary.go Implements model definition + get/upsert/list helpers and size limit constant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread models/actions/run_job_summary.go Outdated
Comment thread routers/api/actions/runner/runner.go Outdated
Comment thread routers/web/repo/actions/view.go
Comment thread routers/api/actions/job_summary.go Outdated
Comment thread routers/api/actions/job_summary.go
Comment thread routers/api/actions/job_summary.go Outdated
@silverwind
Copy link
Copy Markdown
Member

silverwind commented May 5, 2026

One major architectural concern: On GitHub, GITHUB_STEP_SUMMARY is per-step but this implementation is per-job.

GitHub collects all summaries from all steps and then combines them into one big job summary. Imho this must be fixed, as future fixes would require DB migrations.

Will post Claude's review below.

@silverwind
Copy link
Copy Markdown
Member

silverwind commented May 5, 2026

  1. Upsert is racy. GetActionRunJobSummary followed by Insert/Update runs outside a transaction. Concurrent retries from a runner can both miss, both insert, and one returns 500 on the unique-constraint violation. Wrap in db.WithTx or use INSERT … ON CONFLICT DO UPDATE.
  2. Updated timestamp won't refresh on re-upload. engine.ID(...).Cols(\"content\", \"content_type\").Update(existing) excludes the auto-updated column. Either include \"updated\" in Cols (and set existing.Updated = timeutil.TimeStampNow()), or drop the Cols filter.
  3. Dead code + mismatched test string. task.Job.RunID != runID in uploadJobSummary is unreachable — validateRunID already enforces it. The run-mismatch subtest asserts \"run-id does not match\" (validateRunID's string), not the handler's \"run_id mismatch\". Drop the redundant check or rewrite the test to actually reach it.
  4. Summary is hidden on the per-job view (gated on !props.jobId in RepoActionView.vue). GitHub renders summaries on the job surface; here they vanish once a job is selected. Consider rendering in both places, or move to the job pane.
  5. Missing i18n key. locale.jobSummaries ?? 'Job summaries' ships English to every locale — the ?? fallback masks a missing entry in the Vue locale dictionary.
  6. Per-job vs per-step storage — worth deciding up front. GitHub's runner uploads one attachment per step (keyed by step context ID); the rendered output is merged, so this PR matches the visible result. But per-step rows would enable progressive display while a job is still running and a "summary present" indicator on individual steps. Migrating later requires a data migration.

Smaller: errorsIsInvalidArg is a one-call helper (inline it); per-column INDEX tags on RepoID/RunID/RunAttemptID/JobID are redundant with the composite UNIQUE(summary_key) for the access patterns this PR adds.


Reviewed with Claude Opus 4.7.

@silverwind silverwind marked this pull request as draft May 6, 2026 02:42
@silverwind silverwind added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/enhancement An improvement of existing functionality type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Actions - Job Summary

5 participants