File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import * as vscode from "vscode" ;
22
33import { GitHubRepoContext } from "../../git/repository" ;
4+ import { hasWritePermission } from "../../git/repository-permissions" ;
45import { RunStore } from "../../store/store" ;
56import { WorkflowRun } from "../../store/workflowRun" ;
67import { getIconForWorkflowRun } from "../icons" ;
@@ -27,11 +28,15 @@ export class WorkflowRunNode extends vscode.TreeItem {
2728 this . run = run ;
2829 this . label = WorkflowRunNode . _getLabel ( run , this . workflowName ) ;
2930
30- if ( this . run . run . status === "completed" ) {
31- this . contextValue = "run rerunnable completed";
32- } else {
33- this . contextValue = "run cancelable";
31+ const contextValues = [ "run" ] ;
32+ const completed = this . run . run . status === " completed";
33+ if ( hasWritePermission ( this . gitHubRepoContext . permissionLevel ) ) {
34+ contextValues . push ( completed ? "rerunnable" : " cancelable") ;
3435 }
36+ if ( completed ) {
37+ contextValues . push ( "completed" ) ;
38+ }
39+ this . contextValue = contextValues . join ( " " ) ;
3540
3641 this . iconPath = getIconForWorkflowRun ( this . run . run ) ;
3742 this . tooltip = this . getTooltip ( ) ;
You can’t perform that action at this time.
0 commit comments