mirror of
https://github.com/actions/runner.git
synced 2025-12-10 12:36:23 +00:00
* Add basic framework for baby steps runner
* Basic logic for adding steps / invoking composite action steps
* Composite Steps Runner MVP
* Fix null object reference error
* intialize composiute
* Comment out code that is handled by stepsrunner
* Add composite clean up step
* Remove previous 'workarounds' from StepsRunner. Clean Up PR
* Remove todo
* Remove todo
* Fix using unitialized object yikes
* Remove time delay
* Format handler
* Move output handler into action handler
* Add try to evaluate display name
* Remove while loop yikes
* Abstract away the windows encoding check during step running
* Github context set to {ScopeName}.{ContextName} or {ContextName} if ScopeName is null
* Remove setting result to sucess since result defaults to sucess
* Fix windows error
* Fix windows
* revert:
* Windows fix
* Fix Windows Error in Abstraction
* Remove Composite Steps Runner => consolidate into Composite Steps Runner
* Remove unn. attribute in ExecutionContext
* Change protection levels, plus change function name to more clear meaning
* Remove location param
* location pt.2 fix
* Remove outputs step
* Remove temp directory
* new line
* Add arguitl not null
* better comment
* Change encoding name
* Check count > 0 for composite steps, import System.Threading
* Change function header encodingutil
* Add TODO
* Add await
* Handle Failed Step
* Move over SetAllCompositeOutputs to the handler
* Remove timeout-minutes setting in steps-level
* Use only ExecutionContext
* Move using to the top
* Remove redundant check
* Change function name
* Remove testing code
* Consolidate error code
* Consolidate code
* Change HandleOutput => ProcessCompositeActionOutputs
* Remove set the timeout comment
* Add Cancelling functionality + Remove unn. parameter
52 lines
2.1 KiB
C#
52 lines
2.1 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using GitHub.Runner.Sdk;
|
|
using GitHub.Runner.Common;
|
|
|
|
namespace GitHub.Runner.Common.Util
|
|
{
|
|
public static class EncodingUtil
|
|
{
|
|
public static async Task SetEncoding(IHostContext hostContext, Tracing trace, CancellationToken cancellationToken)
|
|
{
|
|
#if OS_WINDOWS
|
|
try
|
|
{
|
|
if (Console.InputEncoding.CodePage != 65001)
|
|
{
|
|
using (var p = hostContext.CreateService<IProcessInvoker>())
|
|
{
|
|
// Use UTF8 code page
|
|
int exitCode = await p.ExecuteAsync(workingDirectory: hostContext.GetDirectory(WellKnownDirectory.Work),
|
|
fileName: WhichUtil.Which("chcp", true, trace),
|
|
arguments: "65001",
|
|
environment: null,
|
|
requireExitCodeZero: false,
|
|
outputEncoding: null,
|
|
killProcessOnCancel: false,
|
|
redirectStandardIn: null,
|
|
inheritConsoleHandler: true,
|
|
cancellationToken: cancellationToken);
|
|
if (exitCode == 0)
|
|
{
|
|
trace.Info("Successfully returned to code page 65001 (UTF8)");
|
|
}
|
|
else
|
|
{
|
|
trace.Warning($"'chcp 65001' failed with exit code {exitCode}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
trace.Warning($"'chcp 65001' failed with exception {ex.Message}");
|
|
}
|
|
#endif
|
|
// Dummy variable to prevent compiler error CS1998: "This async method lacks 'await' operators and will run synchronously..."
|
|
await Task.CompletedTask;
|
|
}
|
|
}
|
|
}
|