diff --git a/docs/contribute/vscode.md b/docs/contribute/vscode.md index 65ec207c0..f89682951 100644 --- a/docs/contribute/vscode.md +++ b/docs/contribute/vscode.md @@ -35,7 +35,7 @@ All the configs below can be found in `.vscode/launch.json`. If you launch `Run` or `Run [build]`, it starts a process called `Runner.Listener`. This process will receive any job queued on this repository if the job runs on matching labels (e.g `runs-on: self-hosted`). Once a job is received, a `Runner.Listener` starts a new process of `Runner.Worker`. -Since this is a diferent process, you can't use the same debugger session debug it. +Since this is a different process, you can't use the same debugger session debug it. Instead, a parallel debugging session has to be started, using a different launch config. Luckily, VS Code supports multiple parallel debugging sessions. diff --git a/src/Runner.Worker/JobExtension.cs b/src/Runner.Worker/JobExtension.cs index 246274734..770db6643 100644 --- a/src/Runner.Worker/JobExtension.cs +++ b/src/Runner.Worker/JobExtension.cs @@ -321,7 +321,10 @@ namespace GitHub.Runner.Worker if (message.Variables.TryGetValue("system.workflowFileFullPath", out VariableValue workflowFileFullPath)) { - context.Output($"Uses: {workflowFileFullPath.Value}"); + var usesLogText = $"Uses: {workflowFileFullPath.Value}"; + var reference = GetWorkflowReference(message.Variables); + context.Output(usesLogText + reference); + if (message.ContextData.TryGetValue("inputs", out var pipelineContextData)) { var inputs = pipelineContextData.AssertDictionary("inputs"); @@ -335,11 +338,11 @@ namespace GitHub.Runner.Worker context.Output("##[endgroup]"); } } + } - if (!string.IsNullOrWhiteSpace(message.JobDisplayName)) - { - context.Output($"Complete job name: {message.JobDisplayName}"); - } + if (!string.IsNullOrWhiteSpace(message.JobDisplayName)) + { + context.Output($"Complete job name: {message.JobDisplayName}"); } var intraActionStates = new Dictionary>(); @@ -452,6 +455,24 @@ namespace GitHub.Runner.Worker } } + private string GetWorkflowReference(IDictionary variables) + { + var reference = ""; + if (variables.TryGetValue("system.workflowFileSha", out VariableValue workflowFileSha)) + { + if (variables.TryGetValue("system.workflowFileRef", out VariableValue workflowFileRef) + && !string.IsNullOrEmpty(workflowFileRef.Value)) + { + reference += $"@{workflowFileRef.Value} ({workflowFileSha.Value})"; + } + else + { + reference += $"@{workflowFileSha.Value}"; + } + } + return reference; + } + public void FinalizeJob(IExecutionContext jobContext, Pipelines.AgentJobRequestMessage message, DateTime jobStartTimeUtc) { Trace.Entering();