forked from actions/runner
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Composite Run Steps Refactoring (actions#591)
* 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
- Loading branch information
1 parent
a3b1282
commit 455bce6
Showing
7 changed files
with
305 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.