Workflow Artifact Info Hover (#37100)

Add expiry metadata to action artifacts in the run view and show it on hover.

---------

Signed-off-by: Nicolas <bircni@icloud.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Nicolas
2026-04-19 09:37:50 +02:00
committed by GitHub
parent 0bc2a2836f
commit 16bdae53c8
16 changed files with 157 additions and 30 deletions

View File

@@ -1,5 +1,6 @@
// see "models/actions/status.go", if it needs to be used somewhere else, move it to a shared file like "types/actions.ts"
export type ActionsRunStatus = 'unknown' | 'waiting' | 'running' | 'success' | 'failure' | 'cancelled' | 'skipped' | 'blocked';
export type ActionsArtifactStatus = 'expired' | 'completed';
export type ActionsRun = {
repoId: number,
@@ -49,5 +50,7 @@ export type ActionsJob = {
export type ActionsArtifact = {
name: string;
status: string;
size: number;
status: ActionsArtifactStatus;
expiresUnix: number;
};

View File

@@ -2,6 +2,7 @@ import tippy, {followCursor} from 'tippy.js';
import {isDocumentFragmentOrElementNode} from '../utils/dom.ts';
import type {Content, Instance, Placement, Props} from 'tippy.js';
import {html} from '../utils/html.ts';
import {stripTags} from '../utils.ts';
type TippyOpts = {
role?: string,
@@ -85,6 +86,7 @@ function attachTooltip(target: Element, content: Content | null = null): Instanc
role: 'tooltip',
theme: 'tooltip',
hideOnClick,
allowHTML: target.getAttribute('data-tooltip-render') === 'html',
placement: target.getAttribute('data-tooltip-placement') as Placement || 'top-start',
followCursor: target.getAttribute('data-tooltip-follow-cursor') as Props['followCursor'] || false,
...(target.getAttribute('data-tooltip-interactive') === 'true' ? {interactive: true, aria: {content: 'describedby', expanded: false}} : {}),
@@ -127,7 +129,10 @@ function attachLazyTooltip(el: HTMLElement): void {
if (!el.hasAttribute('aria-label')) {
const content = el.getAttribute('data-tooltip-content');
if (content) {
el.setAttribute('aria-label', content);
const isHtml = el.getAttribute('data-tooltip-render') === 'html';
let ariaLabelValue = content;
if (isHtml) ariaLabelValue = stripTags(content).replace(/\s+/g, ' ').trim();
el.setAttribute('aria-label', ariaLabelValue);
}
}
}