Skip to content

Commit f2bb5f4

Browse files
committed
Support color API for pinned workflows
Closes: #69
1 parent f158299 commit f2bb5f4

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/pinnedWorkflows/pinnedWorkflows.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import * as vscode from "vscode";
2+
3+
import { GitHubContext, getGitHubContext } from "../git/repository";
24
import {
35
getPinnedWorkflows,
46
isPinnedWorkflowsRefreshEnabled,
57
onPinnedWorkflowsChange,
68
pinnedWorkflowsRefreshInterval,
79
} from "../configuration/configuration";
8-
import { getGitHubContext, GitHubContext } from "../git/repository";
10+
911
import { WorkflowRun } from "../model";
1012
import { getCodIconForWorkflowrun } from "../treeViews/icons";
1113

@@ -140,6 +142,15 @@ async function updatePinnedWorkflow(
140142
pinnedWorkflow.statusBarItem.text = `$(${getCodIconForWorkflowrun(
141143
mostRecentRun
142144
)}) ${pinnedWorkflow.workflowName}`;
145+
146+
if (mostRecentRun.conclusion === "failure") {
147+
pinnedWorkflow.statusBarItem.backgroundColor = new vscode.ThemeColor(
148+
"statusBarItem.errorBackground"
149+
);
150+
} else {
151+
pinnedWorkflow.statusBarItem.backgroundColor = undefined;
152+
}
153+
143154
pinnedWorkflow.statusBarItem.command = {
144155
title: "Open workflow run",
145156
command: "github-actions.workflow.run.open",

src/treeViews/icons.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export function getIconForWorkflowRun(runOrJob: IStatusAndConclusion) {
2525

2626
function _getIconForWorkflowrun(
2727
runOrJob: IStatusAndConclusion
28-
): string | vscode.ThemeIcon {
28+
):
29+
| string
30+
| vscode.ThemeIcon
31+
| { light: string | vscode.Uri; dark: string | vscode.Uri } {
2932
switch (runOrJob.status) {
3033
case "completed": {
3134
switch (runOrJob.conclusion) {

0 commit comments

Comments
 (0)