Skip to content

Commit abf04e5

Browse files
committed
ensure that GITHUB_STEP_SUMMARY is not set
1 parent 291d528 commit abf04e5

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/Smdn.Extensions.Mtp.LiquidTestReports/Smdn.Extensions.Mtp.LiquidTestReports/LiquidTestReportsConverter.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,19 +486,20 @@ GitHub Actions step summary line #3
486486
var stepSummaryFile = isEnvVarSet
487487
? new FileInfo(GetFilePathForTestCase($"{nameof(GITHUB_STEP_SUMMARY)}-{enableOption}-{isEnvVarSet}", TemplateFileExtension))
488488
: null;
489-
string? initialValueOfEnvVar = null;
489+
var initialValueOfEnvVar = Environment.GetEnvironmentVariable(GITHUB_STEP_SUMMARY);
490490

491491
try {
492492
if (isEnvVarSet) {
493-
initialValueOfEnvVar = Environment.GetEnvironmentVariable(GITHUB_STEP_SUMMARY);
494-
495493
Environment.SetEnvironmentVariable(GITHUB_STEP_SUMMARY, stepSummaryFile!.FullName);
496494

497495
await File.WriteAllTextAsync(
498496
path: stepSummaryFile.FullName,
499497
contents: InitialStepSummaryFileContents
500498
).ConfigureAwait(false);
501499
}
500+
else {
501+
Environment.SetEnvironmentVariable(GITHUB_STEP_SUMMARY, null);
502+
}
502503

503504
await RunTestApplicationWithDefaultConfigurations(
504505
templateFileContents: TestCaseAndOutcomeTemplateFileContent,
@@ -548,8 +549,7 @@ await File.ReadAllTextAsync(stepSummaryFile!.FullName).ConfigureAwait(false),
548549
).ConfigureAwait(false);
549550
}
550551
finally {
551-
if (isEnvVarSet)
552-
Environment.SetEnvironmentVariable(GITHUB_STEP_SUMMARY, initialValueOfEnvVar);
552+
Environment.SetEnvironmentVariable(GITHUB_STEP_SUMMARY, initialValueOfEnvVar);
553553
}
554554
}
555555
}

0 commit comments

Comments
 (0)