feat: add copy button to action step header, improve other copy buttons#37744
Conversation
Adds a copy button to each action step header that copies the step's rendered log output to clipboard. For collapsed steps the logs are fetched on demand via the existing actions-view endpoint. Along the way: - Extract a shared `copyToClipboard(target, content)` helper in `clipboard.ts` with a re-entry guard and SVG success/failure feedback (octicon-check / octicon-x). Migrates `copycontent.ts` and the dropzone "Copy link" to use it. - Wrap indented markdown code blocks in the same `<div class="code-block-container">` as the fenced renderer so the existing code-copy button applies to both syntaxes. - Spinner height for the new helper is sourced from `--loading-size`, falling back to the previous `min(4em, 66.6%)` for existing callers. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
|
There was also an issue somewhere which requested that... |
|
Was #26116 |
FYI this is a problem I encountered while testing the copy buttons. Markdown code block created via indentation were not showing a copy button, now they do. Could potentially extract to another PR. |
Moved to its own PR (go-gitea#37748) since it's an independent bug fix. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Extracted to #37748 |
There was a problem hiding this comment.
Pull request overview
This PR adds a “copy step output” control to the Actions job step header and consolidates various copy-to-clipboard behaviors behind a shared copyToClipboard() helper that provides inline SVG success/failure feedback and a consistent loading spinner size.
Changes:
- Add a copy button to each Actions job step header that copies either rendered logs (expanded) or fetched logs (collapsed).
- Refactor existing copy interactions (file content copy, dropzone attachment markdown link copy, global
data-clipboard-*handler) to use a sharedcopyToClipboard()helper with icon feedback. - Adjust loading spinner CSS to support
btn-octiconand allow the spinner size to be driven by--loading-size.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web_src/js/features/repo-actions.ts | Passes the new copyStepOutput locale string into the Actions view Vue app. |
| web_src/js/features/dropzone.ts | Replaces ad-hoc clipboard+tooltip copy with the new copyToClipboard() helper. |
| web_src/js/features/copycontent.ts | Refactors file content copying (including image conversion) to use copyToClipboard() with loading handling. |
| web_src/js/features/clipboard.ts | Introduces copyToClipboard() with loading + SVG feedback, and wires it into the global data-clipboard-* click handler. |
| web_src/js/components/ActionRunJobView.vue | Adds the per-step “copy output” button and implements on-demand log fetching for collapsed steps. |
| web_src/css/modules/animations.css | Ensures .btn-octicon.is-loading hides children; makes loading spinner height configurable via --loading-size. |
| templates/repo/actions/view_component.tmpl | Provides data-locale-copy-step-output to the Actions view container. |
| templates/base/head_script.tmpl | Removes global i18n.copy_success / i18n.copy_error entries. |
| options/locale/locale_en-US.json | Adds the copy_step_output translation string. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The render path skips both `hidden` and `endgroup` commands (only `group` emits a summary line). The fetch path was skipping only `hidden`, so copying from a collapsed step produced extra blank lines. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
|
Should it copy the timestamp if it displayed? |
No I dont see a use case for that |
It might be useful for timing-related issues, I'm undecided. |
This comment was marked as resolved.
This comment was marked as resolved.
|
If it's for machine parsing, then yes, raw with timestamp might be better. |
|
Do the new change look good to you? If any doesn't look good, feel free to revert or reset. |
|
Not sure I like this |
Renamed it to copyContentToClipboard |
Is this still WIP? |
|
Yes will fix and re-review those functions. |
Use the browser's resolved hourCycle (collapsed to h12/h23) instead of the hour12 boolean, so the "Show timestamps" output matches what <relative-time> renders. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
The bare primitive takes the unqualified copyToClipboard; the DOM/feedback variant becomes copyToClipboardWithFeedback, so callers see the difference. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
|
Functions renamed:
I think that's the cleanest option by far. |
|
@wxiaoguang looking good? |
|
@silverwind please fix the merge conflicts. 🍵 |
* origin/main: style: misc UI fixes (go-gitea#37691) ci: shard tests and reduce redundant work (go-gitea#37618) chore: simplify issue and pull request templates (go-gitea#37799) # Conflicts: # web_src/js/components/ActionRunJobView.vue
copyToClipboard(target, content)helper inclipboard.tsthat adds SVG success/failure feedback.is-loadingheight for the new helper is sourced from--loading-size.The indented-markdown code-block fix has moved to #37748.
Fixes: #26116
This PR was written with the help of Claude Opus 4.7