feat(github): GitHub Actions tool window with job logs and re-runs (#6767)

Adds a GitHub Actions tool window listing the workflow runs of the current branch (including its pull request runs), with a toggle for every branch. Expanding a run lists its jobs; selecting a job shows its log with runner timestamps and group markers removed and error lines highlighted. The toolbar has Re-run Failed Jobs, Re-run All Jobs, Re-run Job, Open in Browser and Refresh, and the list refreshes every 15 seconds while anything runs.

gh 2.104 refuses to print responses containing terminal escape sequences unless --allow-escape-sequences is passed; ide_github::api retries a GET with the flag only when gh refused for that reason, so older gh versions keep working.

resetConnection now clears a GitHub check still running for the previous project, which left the connection stuck in "checking" after switching projects.

The tool window uses the github icon (the build tool window already uses toolwindow-build), and "GitHub Actions" is kept untranslated in zh.

Closes #6716

Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
LU XIANGRUIтаwildcatDownstairs authored and GitHub committed 2026-11-29 13:59:25 +08:00
1 джерело f8a9b204c6
коміт 7ab456b1e7
19 files changed
+672 -10

No files matched your search

+25 -3
Переглянути файл
@@ -353,12 +353,25 @@ pub fn url_host(url: &str) -> Option<&str> {
/// Runs `req`; returns the response body (JSON text, empty for `204 No Content`).
pub fn api(root: &Path, req: &GhApiRequest) -> IdeResult<String> {
let args = api_args(req)?;
let refs: Vec<&str> = args.iter().map(String::as_str).collect();
let out = process::run_with_input(command(root, &refs)?, req.body.as_deref(), QUICK, None)?;
let mut args = api_args(req)?;
let run = |args: &[String]| {
let refs: Vec<&str> = args.iter().map(String::as_str).collect();
process::run_with_input(command(root, &refs)?, req.body.as_deref(), QUICK, None)
};
let mut out = run(&args)?;
// Recent gh refuses plain-text bodies with terminal escape sequences (coloured Actions job
// logs) unless allowed; older gh lacks the flag. Only a GET is safe to send twice.
if !out.success && req.method.eq_ignore_ascii_case("GET") && refused_escape_sequences(&out.stderr) {
args.insert(1, "--allow-escape-sequences".into());
out = run(&args)?;
}
if out.success { Ok(out.stdout) } else { Err(failure(&out.stderr, &out.stdout)) }
}
fn refused_escape_sequences(stderr: &str) -> bool {
stderr.contains("--allow-escape-sequences")
}
/// Revisions to diff a pull request's files with, present in the local repository.
#[derive(Clone, Debug, Serialize, Deserialize, Type)]
#[serde(rename_all = "camelCase")]
@@ -413,6 +426,15 @@ pub fn prepare_diff(
#[cfg(test)]
mod tests {
#[test]
fn recognises_gh_refusing_escape_sequences() {
// gh 2.104's message for a coloured Actions job log.
assert!(super::refused_escape_sequences(
"the response contains terminal escape sequences; pass --allow-escape-sequences to output it anyway\n"
));
assert!(!super::refused_escape_sequences("gh: Not Found (HTTP 404)"));
}
#[test]
fn gh_executable_picks_up_newly_installed_binary_without_restart() {
let dir = std::env::temp_dir().join(format!("openidea-gh-test-{}", std::process::id()));
+1
Переглянути файл
@@ -762,6 +762,7 @@ pub fn spec(os: Os) -> Vec<Entry> {
SEP,
act("github.createGist", "Create Gist…"),
act("github.shareProject", "Share Project on GitHub"),
act("github.actions.show", "GitHub Actions"),
],
),
act("vcs.manageRemotes", "Manage Remotes…"),
+37
Переглянути файл
@@ -0,0 +1,37 @@
.view {
height: 100%;
display: flex;
min-height: 0;
}
.toolbar {
flex: none;
display: flex;
flex-direction: column;
gap: var(--space-1);
padding: var(--space-1);
border-inline-end: 1px solid var(--border);
overflow-y: auto;
}
.split {
flex: 1;
min-width: 0;
}
.runs {
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
}
.runs > :last-child {
flex: 1;
min-height: 0;
}
.error {
padding: 2px 10px;
color: var(--danger);
font-size: var(--fs-small);
}
.hint {
padding: 12px;
color: var(--fg-muted);
}
+180
Переглянути файл
@@ -0,0 +1,180 @@
/**
* GitHub Actions tool window: the connected repository's workflow runs (current branch by
* default) with their jobs, and the selected job's log.
*/
import { useEffect } from "react";
import { useVcs } from "@/features/vcs/store";
import { executeAction } from "@/platform/actions";
import { tx } from "@/platform/i18n";
import { Button, IconButton, LogPane, SplitGroup, SplitHandle, SplitPanel, T, Toolbar, Tree } from "@/ui";
import { STATUS_ICON } from "../details/model";
import { refreshConnection, useGhRepository } from "../data/repository";
import { prettyDate } from "../ui/prettyDate";
import { Placeholder } from "../ui/Placeholder";
import { canRerun, canRerunFailed, duration, logLines, statusIcon, type WorkflowJob, type WorkflowRun } from "./model";
import {
anyActive,
jobLog,
loadJobs,
refreshRuns,
resetActions,
selection,
setBranchOnly,
useGhActions,
} from "./store";
import styles from "./Actions.module.css";
type Node = { kind: "run"; run: WorkflowRun } | { kind: "job"; job: WorkflowJob };
const key = (n: Node) => (n.kind === "run" ? `run:${n.run.id}` : `job:${n.job.id}`);
const POLL_MS = 15_000;
function runDetail(run: WorkflowRun) {
const pr = run.pull_requests?.[0];
return [
`${run.name ?? ""} #${run.run_number}`,
run.event,
pr ? `#${pr.number}` : run.head_branch,
run.head_sha.slice(0, 7),
prettyDate(run.created_at),
]
.filter(Boolean)
.join(" · ");
}
function JobLog({ job }: { job: WorkflowJob }) {
return (
<LogPane
// Loads again when the job changes (finishes), not on every refresh of the list.
sourceKey={`${job.id}:${job.status}:${job.completed_at ?? ""}`}
live={false}
ariaLabel={tx`Log of ${job.name}`}
start={(onLine, onError) => {
let stopped = false;
jobLog(job.id).then(
(text) => {
if (!stopped) for (const l of logLines(text)) onLine(l);
},
(e: unknown) => {
if (stopped) return;
// GitHub has no log for a job that hasn't finished (or started).
onError(
job.status === "completed"
? String(e instanceof Error ? e.message : e)
: tx("The log is available once the job finishes."),
);
},
);
return () => {
stopped = true;
};
}}
/>
);
}
export function ActionsToolWindow() {
const connected = useGhRepository((s) => !!s.connection);
const repository = useGhRepository((s) => {
const c = s.connection;
return c ? `${c.coordinates.host}/${c.coordinates.owner}/${c.coordinates.name}@${c.root ?? ""}` : null;
});
const head = useVcs((s) => s.branch?.head ?? null);
// Not checked yet, or reset by a project switch: check (again).
const unchecked = useGhRepository((s) => !s.availability && !s.checking);
const state = useGhActions();
const { run, job } = selection(state);
const active = anyActive(state);
useEffect(() => {
resetActions();
if (repository) void refreshRuns();
}, [repository]);
useEffect(() => {
if (!connected && unchecked) void refreshConnection();
}, [connected, unchecked]);
// Another branch checked out: its runs.
useEffect(() => {
if (useGhRepository.getState().connection && useGhActions.getState().branchOnly) void refreshRuns();
}, [head]);
useEffect(() => {
if (!connected || !active) return;
const t = setInterval(() => void refreshRuns(), POLL_MS);
return () => clearInterval(t);
}, [connected, active]);
if (!connected)
return (
<Placeholder title="Not connected to a GitHub repository">
<Button onClick={() => void executeAction("github.pullRequests")}>
<T>View Pull Requests</T>
</Button>
</Placeholder>
);
const roots: Node[] = state.runs.map((r) => ({ kind: "run", run: r }));
return (
<div className={styles.view}>
<Toolbar aria-label="GitHub Actions" orientation="vertical" className={styles.toolbar}>
<IconButton icon="refresh" size="small" action="github.actions.refresh" disabled={state.loading} />
<IconButton
icon="branch"
size="small"
title="Current Branch Only"
pressed={state.branchOnly}
onClick={() => setBranchOnly(!state.branchOnly)}
/>
<IconButton
icon="rerun"
tone="danger"
size="small"
action="github.actions.rerunFailedJobs"
disabled={!run || !canRerunFailed(run)}
/>
<IconButton icon="rerun" size="small" action="github.actions.rerunAllJobs" disabled={!run || !canRerun(run)} />
<IconButton icon="run" size="small" action="github.actions.rerunJob" disabled={!job || !canRerun(job)} />
<IconButton icon="external-link" size="small" action="github.actions.openInBrowser" disabled={!run} />
</Toolbar>
<SplitGroup orientation="horizontal" storageKey="openidea.github.actions.split" className={styles.split}>
<SplitPanel id="runs" defaultSize="45%" minSize="20%" className={styles.runs}>
{state.error && <div className={styles.error}>{state.error}</div>}
<Tree<Node>
aria-label={tx("Workflow runs")}
roots={roots}
getKey={key}
getLabel={(n) => (n.kind === "run" ? n.run.display_title : n.job.name)}
getIcon={(n) => STATUS_ICON[statusIcon(n.kind === "run" ? n.run : n.job)]}
getDetail={(n) => (n.kind === "run" ? runDetail(n.run) : duration(n.job.started_at, n.job.completed_at))}
getChildren={(n) =>
n.kind === "run" ? state.jobs[n.run.id]?.map((j): Node => ({ kind: "job", job: j })) : undefined
}
isExpandable={(n) => n.kind === "run"}
loadChildren={(n) => (n.kind === "run" ? loadJobs(n.run.id) : undefined)}
selected={state.selected ? new Set([state.selected]) : new Set()}
onSelectionChange={(_, lead) => useGhActions.setState({ selected: lead ? key(lead) : null })}
empty={
state.loading ? (
<T>Loading…</T>
) : state.branchOnly && state.branch ? (
tx`No workflow runs for ${state.branch}`
) : (
<T>No workflow runs</T>
)
}
speedSearch
/>
</SplitPanel>
<SplitHandle aria-label={tx("Resize workflow runs and log")} />
<SplitPanel id="log" minSize="25%">
{job ? (
<JobLog job={job} />
) : (
<div className={styles.hint}>
<T>Select a job to see its log</T>
</div>
)}
</SplitPanel>
</SplitGroup>
</div>
);
}
+55
Переглянути файл
@@ -0,0 +1,55 @@
import { describe, expect, it } from "vitest";
import { canRerunFailed, duration, logLines, runsEndpoint, statusIcon, type WorkflowRun } from "./model";
const run = (status: string, conclusion: string | null) => ({ status, conclusion }) as WorkflowRun;
describe("workflow runs", () => {
it("lists the branch's runs, or every branch's", () => {
expect(runsEndpoint("repos/o/r", "feat/a b")).toBe("repos/o/r/actions/runs?per_page=30&branch=feat%2Fa%20b");
expect(runsEndpoint("repos/o/r", null)).toBe("repos/o/r/actions/runs?per_page=30");
});
it("maps status and conclusion to an icon", () => {
expect(statusIcon(run("in_progress", null))).toBe("pending");
expect(statusIcon(run("queued", null))).toBe("pending");
expect(statusIcon(run("completed", "success"))).toBe("success");
expect(statusIcon(run("completed", "timed_out"))).toBe("failed");
expect(statusIcon(run("completed", "skipped"))).toBe("skipped");
expect(statusIcon(run("completed", "action_required"))).toBe("warning");
});
it("offers Re-run Failed Jobs only for a finished run that failed or was cancelled", () => {
expect(canRerunFailed(run("completed", "failure"))).toBe(true);
expect(canRerunFailed(run("completed", "cancelled"))).toBe(true);
expect(canRerunFailed(run("completed", "success"))).toBe(false);
expect(canRerunFailed(run("in_progress", null))).toBe(false);
});
it("formats durations", () => {
expect(duration("2026-01-01T00:00:00Z", "2026-01-01T00:00:12Z")).toBe("12s");
expect(duration("2026-01-01T00:00:00Z", "2026-01-01T00:05:03Z")).toBe("5m 03s");
expect(duration("2026-01-01T00:00:00Z", "2026-01-01T01:02:00Z")).toBe("1h 02m");
expect(duration(null, null)).toBe("");
});
});
describe("logLines", () => {
it("drops timestamps and group markers and sends errors to stderr", () => {
const log = [
"2026-11-28T10:00:00.1234567Z ##[group]Run cargo test",
"2026-11-28T10:00:00.2000000Z cargo test --workspace",
"2026-11-28T10:00:01.0000000Z ##[endgroup]",
"2026-11-28T10:00:02.0000000Z test a ... FAILED",
"2026-11-28T10:00:03.0000000Z ##[error]Process completed with exit code 101.",
"plain line",
"",
].join("\r\n");
expect(logLines(log)).toEqual([
{ stderr: false, text: "▾ Run cargo test" },
{ stderr: false, text: "cargo test --workspace" },
{ stderr: false, text: "test a ... FAILED" },
{ stderr: true, text: "Process completed with exit code 101." },
{ stderr: false, text: "plain line" },
]);
});
});
+86
Переглянути файл
@@ -0,0 +1,86 @@
/**
* GitHub Actions workflow runs and jobs (REST `actions/runs`, `actions/jobs`): how they
* show and which re-runs apply, plus the job log as the tool window prints it.
*/
import type { LogLine } from "@/ui/LogPane";
import type { StatusIcon } from "../details/model";
export interface WorkflowRun {
id: number;
name: string | null;
display_title: string;
run_number: number;
run_attempt?: number;
event: string;
status: string | null;
conclusion: string | null;
head_branch: string | null;
head_sha: string;
html_url: string;
created_at: string;
pull_requests?: Array<{ number: number }>;
}
export interface WorkflowJob {
id: number;
run_id: number;
name: string;
status: string;
conclusion: string | null;
started_at: string | null;
completed_at: string | null;
html_url: string | null;
}
/** Runs of `branch` (every branch when null), newest first; `branch` includes its pull request runs. */
export function runsEndpoint(repoPath: string, branch: string | null): string {
const q = branch ? `&branch=${encodeURIComponent(branch)}` : "";
return `${repoPath}/actions/runs?per_page=30${q}`;
}
export const isActive = (s: { status: string | null }) => s.status !== null && s.status !== "completed";
const FAILED = new Set(["failure", "cancelled", "timed_out", "startup_failure"]);
/** `STATUS_ICON` key of a run or job. */
export function statusIcon(s: { status: string | null; conclusion: string | null }): StatusIcon {
if (isActive(s)) return "pending";
if (s.conclusion === "success") return "success";
if (s.conclusion && FAILED.has(s.conclusion)) return "failed";
if (s.conclusion === "action_required") return "warning";
return "skipped";
}
/** GitHub offers "Re-run failed jobs" for a finished run that failed or was cancelled. */
export const canRerunFailed = (run: WorkflowRun) => !isActive(run) && FAILED.has(run.conclusion ?? "");
export const canRerun = (s: { status: string | null }) => !isActive(s);
/** `5m 03s`, `1h 02m`, `12s` between two timestamps. */
export function duration(from: string | null, to: string | null, now = Date.now()): string {
if (!from) return "";
const s = Math.max(0, Math.round(((to ? Date.parse(to) : now) - Date.parse(from)) / 1000));
const pad = (n: number) => String(n).padStart(2, "0");
if (s >= 3600) return `${Math.floor(s / 3600)}h ${pad(Math.floor(s / 60) % 60)}m`;
if (s >= 60) return `${Math.floor(s / 60)}m ${pad(s % 60)}s`;
return `${s}s`;
}
const TIMESTAMP = /^\uFEFF?\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)?Z ?/;
/**
* A job log as printed: without the runner's per-line timestamps and `##[group]` /
* `##[endgroup]` markers; `##[error]` lines go to stderr (red).
*/
export function logLines(text: string): LogLine[] {
const out: LogLine[] = [];
for (const raw of text.split(/\r?\n/)) {
const line = raw.replace(TIMESTAMP, "");
if (line.startsWith("##[endgroup]")) continue;
if (line.startsWith("##[group]")) out.push({ stderr: false, text: `▾ ${line.slice(9)}` });
else if (line.startsWith("##[error]")) out.push({ stderr: true, text: line.slice(9) });
else if (line.startsWith("##[warning]")) out.push({ stderr: false, text: line.slice(11) });
else out.push({ stderr: false, text: line });
}
while (out.length && !out[out.length - 1]!.text) out.pop();
return out;
}
+133
Переглянути файл
@@ -0,0 +1,133 @@
/**
* The GitHub Actions tool window's data: workflow runs of the connected repository (the
* current branch's, or every branch's), their jobs, the selection and the re-runs.
*/
import { create } from "zustand";
import { tx } from "@/platform/i18n";
import { call, commands } from "@/platform/ipc";
import { openExternalUrl } from "@/platform/openUrl";
import { notifications } from "@/workbench/contributions";
import { errorMessage, repoPath, rest, restText } from "../api/client";
import { connectedRoot, useGhRepository } from "../data/repository";
import { canRerun, canRerunFailed, isActive, runsEndpoint, type WorkflowJob, type WorkflowRun } from "./model";
interface ActionsState {
/** Only the current branch's runs (else every branch's). */
branchOnly: boolean;
branch: string | null;
runs: WorkflowRun[];
/** Run id → its jobs (latest attempt), once loaded. */
jobs: Record<number, WorkflowJob[]>;
loading: boolean;
error: string | null;
/** `run:<id>` or `job:<id>`. */
selected: string | null;
}
const EMPTY = { branch: null, runs: [], jobs: {}, loading: false, error: null, selected: null };
export const useGhActions = create<ActionsState>(() => ({ branchOnly: true, ...EMPTY }));
let seq = 0;
/** Another repository (or none): forget the runs shown and drop the answers still on their way. */
export function resetActions() {
seq++;
useGhActions.setState(EMPTY);
}
export async function loadJobs(runId: number): Promise<void> {
try {
const r = await rest<{ jobs: WorkflowJob[] }>("GET", `${repoPath()}/actions/runs/${runId}/jobs?per_page=100`);
useGhActions.setState((s) => ({ jobs: { ...s.jobs, [runId]: r.jobs } }));
} catch (e) {
useGhActions.setState({ error: errorMessage(e) });
}
}
/** Reloads the runs, and the jobs already shown. */
export async function refreshRuns(): Promise<void> {
if (!useGhRepository.getState().connection) return;
const n = ++seq;
useGhActions.setState({ loading: true });
try {
const info = await call(commands.vcsBranchInfo(connectedRoot())).catch(() => null);
const branch = info?.head ?? null;
const { branchOnly } = useGhActions.getState();
const r = await rest<{ workflow_runs: WorkflowRun[] }>("GET", runsEndpoint(repoPath(), branchOnly ? branch : null));
if (n !== seq) return;
const loaded = Object.keys(useGhActions.getState().jobs).map(Number);
const ids = new Set(r.workflow_runs.map((run) => run.id));
useGhActions.setState((s) => ({
branch,
runs: r.workflow_runs,
jobs: Object.fromEntries(Object.entries(s.jobs).filter(([id]) => ids.has(Number(id)))),
loading: false,
error: null,
}));
await Promise.all(loaded.filter((id) => ids.has(id)).map(loadJobs));
} catch (e) {
if (n === seq) useGhActions.setState({ loading: false, error: errorMessage(e) });
}
}
export function setBranchOnly(branchOnly: boolean) {
useGhActions.setState({ branchOnly, selected: null });
void refreshRuns();
}
/** Something still runs: worth polling. */
export const anyActive = (s: ActionsState) =>
s.runs.some(isActive) || Object.values(s.jobs).some((jobs) => jobs.some(isActive));
/** The selected run (or the selected job's run) and job. */
export function selection(s: ActionsState = useGhActions.getState()): {
run: WorkflowRun | null;
job: WorkflowJob | null;
} {
const [kind, id] = (s.selected ?? ":").split(":");
if (kind === "run") return { run: s.runs.find((r) => r.id === Number(id)) ?? null, job: null };
if (kind === "job")
for (const [runId, jobs] of Object.entries(s.jobs)) {
const job = jobs.find((j) => j.id === Number(id));
if (job) return { run: s.runs.find((r) => r.id === Number(runId)) ?? null, job };
}
return { run: null, job: null };
}
async function rerun(endpoint: string, what: string) {
try {
await rest("POST", `${repoPath()}/actions/${endpoint}`);
} catch (e) {
notifications().notify({ group: "vcs", level: "error", title: tx("Couldn't re-run"), body: errorMessage(e) });
return;
}
notifications().notify({ group: "vcs", level: "info", title: tx`Re-run of ${what} requested`, key: "github-rerun" });
await refreshRuns();
}
export function rerunFailedJobs() {
const { run } = selection();
if (run && canRerunFailed(run)) return rerun(`runs/${run.id}/rerun-failed-jobs`, `#${run.run_number}`);
}
export function rerunAllJobs() {
const { run } = selection();
if (run && canRerun(run)) return rerun(`runs/${run.id}/rerun`, `#${run.run_number}`);
}
export function rerunJob() {
const { job } = selection();
if (job && canRerun(job)) return rerun(`jobs/${job.id}/rerun`, job.name);
}
export function openSelectedInBrowser() {
const { run, job } = selection();
const url = job?.html_url ?? run?.html_url;
if (url) void openExternalUrl(url);
}
/** The job's log as plain text (gh follows the redirect to the log file). */
export function jobLog(jobId: number): Promise<string> {
return restText("GET", `${repoPath()}/actions/jobs/${jobId}/logs`);
}
+11 -2
Переглянути файл
@@ -68,7 +68,17 @@ export async function rest<T>(
body?: unknown,
opts: { paginate?: boolean; host?: string | null; root?: string | null } = {},
): Promise<T> {
const text = await call(
return parseRest<T>(await restText(method, endpoint, body, opts), opts.paginate ?? false);
}
/** {@link rest}'s response body as it came, for plain-text endpoints (Actions job logs). */
export function restText(
method: GHApiMethod,
endpoint: string,
body?: unknown,
opts: { paginate?: boolean; host?: string | null; root?: string | null } = {},
): Promise<string> {
return call(
commands.ghApi(opts.root === undefined ? (current?.root ?? null) : opts.root, {
method,
endpoint,
@@ -77,7 +87,6 @@ export async function rest<T>(
host: opts.host === undefined ? host : apiHost(opts.host),
}),
);
return parseRest<T>(text, opts.paginate ?? false);
}
/** Parses a REST body; `--slurp` pages (an array of pages) are flattened when they are arrays. */
+25
Переглянути файл
@@ -253,3 +253,28 @@ describe("GitHub Enterprise Server hosts beside github.com", () => {
]);
});
});
describe("switching projects", () => {
it("does not leave the reset state checking when a check of the old project was running", async () => {
let answer!: () => void;
ghAvailability.mockReturnValue(
new Promise((r) => {
answer = () =>
r({
status: "ok",
data: {
kind: "ready",
repo: { nameWithOwner: "org/android", url: "https://github.com/org/android" },
login: "me",
},
});
}),
);
const stale = refreshConnection();
await vi.waitFor(() => expect(ghAvailability).toHaveBeenCalled());
resetConnection();
answer();
await stale;
expect(useGhRepository.getState()).toMatchObject({ availability: null, checking: false, connection: null });
});
});
+8 -1
Переглянути файл
@@ -319,7 +319,14 @@ export function resetConnection() {
checkSeq++;
localRemotes = [];
disconnect({ forget: false });
useGhRepository.setState({ availability: null, remotes: [], defaultRemote: null, connectionError: null });
// A check still running belongs to the old project and will not finish this one's.
useGhRepository.setState({
availability: null,
checking: false,
remotes: [],
defaultRemote: null,
connectionError: null,
});
}
/** The connection, or throws (for operations that only run while connected). */
+59
Переглянути файл
@@ -26,6 +26,7 @@ import { GithubDialogHost } from "./ui/dialogs";
import { activateSettingsPages } from "./settingsPages";
const WINDOW = "pullRequests";
const ACTIONS_WINDOW = "githubActions";
const TIMELINE_KIND = "github.timeline";
const WHEN = "projectOpen";
const CONNECTED = "projectOpen && githubConnected";
@@ -111,6 +112,54 @@ function actions(): ActionSpec[] {
keywords: ["github", "share", "publish", "create repository", "new repository", "push"],
when: WHEN,
},
{
id: "github.actions.show",
title: "GitHub Actions",
description: "Workflow runs of the current branch, their job logs and re-runs.",
category: "GitHub",
icon: "github",
keywords: ["github", "actions", "workflow", "ci", "checks", "runs", "logs"],
when: WHEN,
},
{
id: "github.actions.refresh",
title: "Refresh Workflow Runs",
category: "GitHub",
icon: "refresh",
when: CONNECTED,
},
{
id: "github.actions.rerunFailedJobs",
title: "Re-run Failed Jobs",
category: "GitHub",
// The tool window's buttons: they act on its selection, which only it shows.
hidden: true,
icon: "rerun",
when: CONNECTED,
},
{
id: "github.actions.rerunAllJobs",
title: "Re-run All Jobs",
category: "GitHub",
hidden: true,
icon: "rerun",
when: CONNECTED,
},
{
id: "github.actions.rerunJob",
title: "Re-run Job",
category: "GitHub",
hidden: true,
icon: "run",
when: CONNECTED,
},
{
id: "github.actions.openInBrowser",
title: "Open Workflow Run in Browser",
category: "GitHub",
icon: "external-link",
when: CONNECTED,
},
{
// Github.PullRequest.List.Reload
id: "github.refresh",
@@ -290,6 +339,16 @@ export function activate(): () => void {
headerActions: lazyView("PullRequestsHeaderActions"),
headerMenu: useHeaderMenu,
}),
registerToolWindow({
id: ACTIONS_WINDOW,
title: "GitHub Actions",
icon: "github",
anchor: "bottom",
stripe: "onUse",
component: lazyComponent<{ id: string }>(() =>
import("./actions/ActionsToolWindow").then((m) => m.ActionsToolWindow),
),
}),
registerEditorKind({
kind: TIMELINE_KIND,
component: lazyComponent(() => import("./timeline/TimelineEditor").then((m) => m.TimelineEditor)),
+8 -1
Переглянути файл
@@ -6,7 +6,7 @@
import type { ActionContext } from "@/platform/actions";
import { getContext, setContext } from "@/platform/context";
import { useProject } from "@/platform/project";
import { maybeEditorService, type EditorInput } from "@/workbench/contributions";
import { maybeEditorService, toolWindowService, type EditorInput } from "@/workbench/contributions";
import { activateReviewDiff, toggleReviewDiffViewed } from "./diff";
import { loadProjectGithubAccount, useGhProjectAccount } from "./data/account";
import { reloadList, useGhPrList } from "./data/list";
@@ -24,6 +24,7 @@ import { contextPullRequest, resetTabs } from "./toolwindow/store";
import { activeTimelinePullRequest, openTimeline, timelineIcon, timelineTitle } from "./toolwindow/timelineInput";
import { createGist } from "./gist/createGist";
import { shareProject } from "./share/shareProject";
import * as ghActions from "./actions/store";
import { numberDialog } from "./ui/dialogs";
import { activateWorktreeReviews } from "./worktreeReviews";
@@ -61,6 +62,12 @@ export const runs: Record<string, Run> = {
},
"github.createGist": ({ arg }) => createGist(arg),
"github.shareProject": () => shareProject(),
"github.actions.show": () => toolWindowService().show("githubActions", true),
"github.actions.refresh": () => ghActions.refreshRuns(),
"github.actions.rerunFailedJobs": () => ghActions.rerunFailedJobs(),
"github.actions.rerunAllJobs": () => ghActions.rerunAllJobs(),
"github.actions.rerunJob": () => ghActions.rerunJob(),
"github.actions.openInBrowser": () => ghActions.openSelectedInBrowser(),
"github.refresh": async () => {
await refreshConnection();
if (useGhRepository.getState().connection) await reloadList();
+2
Переглянути файл
@@ -284,6 +284,8 @@ describe("catalogs", () => {
const OWN_SCRIPT = new Set(["zh", "ko"]);
/** Product names intentionally kept as written in every locale. */
const SAME_AS_ENGLISH = new Set([
// GitHub's product name, the title of its tool window.
"GitHub Actions",
"Flutter DevTools",
// The package index's name, as a project link in the Python Packages tool window.
"PyPI",
+1 -1
Переглянути файл
@@ -77,7 +77,7 @@ function actionTitles(): Map<string, string> {
const titles = actionTitles();
/** Product names shown as they are in every language. */
const PROPER_NAMES = new Set(["Code Vision", "GraphQL", "Vim"]);
const PROPER_NAMES = new Set(["Code Vision", "GitHub Actions", "GraphQL", "Vim"]);
it("has a Chinese entry for every literal action title, including action factory arguments", () => {
// Ensure the helper-argument regression cannot disappear through a scanner change.
+1
Переглянути файл
@@ -444,6 +444,7 @@
"menu.github.openInBrowser": "Open on GitHub",
"menu.github.createGist": "Create Gist…",
"menu.github.shareProject": "Share Project on GitHub",
"menu.github.actions.show": "GitHub Actions",
"menu.file.newProject": "Project…",
"menu.file.renameProject": "Rename Project…",
"menu.file.reloadAllFromDisk": "Reload All from Disk",
+19 -1
Переглянути файл
@@ -4589,5 +4589,23 @@
"Shared project on GitHub": "Shared project on GitHub",
"Couldn't share the project on GitHub": "Couldn't share the project on GitHub",
"…and older commits": "…and older commits",
"Repository {url} was created, but: {error}": "Repository {url} was created, but: {error}"
"Repository {url} was created, but: {error}": "Repository {url} was created, but: {error}",
"Log of {name}": "Log of {name}",
"The log is available once the job finishes.": "The log is available once the job finishes.",
"Not connected to a GitHub repository": "Not connected to a GitHub repository",
"GitHub Actions": "GitHub Actions",
"Current Branch Only": "Current Branch Only",
"Workflow runs": "Workflow runs",
"No workflow runs for {branch}": "No workflow runs for {branch}",
"No workflow runs": "No workflow runs",
"Resize workflow runs and log": "Resize workflow runs and log",
"Select a job to see its log": "Select a job to see its log",
"Couldn't re-run": "Couldn't re-run",
"Re-run of {what} requested": "Re-run of {what} requested",
"Workflow runs of the current branch, their job logs and re-runs.": "Workflow runs of the current branch, their job logs and re-runs.",
"Refresh Workflow Runs": "Refresh Workflow Runs",
"Re-run Failed Jobs": "Re-run Failed Jobs",
"Re-run All Jobs": "Re-run All Jobs",
"Re-run Job": "Re-run Job",
"Open Workflow Run in Browser": "Open Workflow Run in Browser"
}
+19 -1
Переглянути файл
@@ -11118,5 +11118,23 @@
"Shared project on GitHub": "已在 GitHub 上分享项目",
"Couldn't share the project on GitHub": "无法在 GitHub 上分享项目",
"…and older commits": "……以及更早的提交",
"Repository {url} was created, but: {error}": "已创建仓库 {url},但:{error}"
"Repository {url} was created, but: {error}": "已创建仓库 {url},但:{error}",
"Log of {name}": "{name} 的日志",
"The log is available once the job finishes.": "作业完成后才能查看日志。",
"Not connected to a GitHub repository": "未连接到 GitHub 仓库",
"GitHub Actions": "GitHub Actions",
"Current Branch Only": "仅当前分支",
"Workflow runs": "工作流运行",
"No workflow runs for {branch}": "{branch} 没有工作流运行",
"No workflow runs": "没有工作流运行",
"Resize workflow runs and log": "调整工作流运行与日志的大小",
"Select a job to see its log": "选择一个作业以查看其日志",
"Couldn't re-run": "无法重新运行",
"Re-run of {what} requested": "已请求重新运行 {what}",
"Workflow runs of the current branch, their job logs and re-runs.": "当前分支的工作流运行、作业日志与重新运行。",
"Refresh Workflow Runs": "刷新工作流运行",
"Re-run Failed Jobs": "重新运行失败的作业",
"Re-run All Jobs": "重新运行所有作业",
"Re-run Job": "重新运行作业",
"Open Workflow Run in Browser": "在浏览器中打开工作流运行"
}
+1
Переглянути файл
@@ -444,6 +444,7 @@
"menu.github.openInBrowser": "在 GitHub 上打开",
"menu.github.createGist": "创建 Gist…",
"menu.github.shareProject": "在 GitHub 上分享项目",
"menu.github.actions.show": "GitHub Actions",
"menu.file.newProject": "项目…",
"menu.file.renameProject": "重命名项目…",
"menu.file.reloadAllFromDisk": "从磁盘全部重新加载",
+1
Переглянути файл
@@ -1667,6 +1667,7 @@ export function gitMenuItems({ paths, dirs, file, ignore, editorSelection }: Git
// The editor menu shares its selection (no argument); the others, their files.
editorSelection ? action("github.createGist") : act("github.createGist"),
action("github.shareProject"),
action("github.actions.show"),
]);
const items: (MenuItem | null)[] = [
single && !dirs?.[0] ? act("vcs.commit", "Commit File…") : act("vcs.commit", "Commit…"),