Skip to content

Commit b10a2a5

Browse files
authored
Update codeql.yml
1 parent 610808a commit b10a2a5

1 file changed

Lines changed: 4 additions & 22 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,9 @@ jobs:
6969
- name: Patch ServerDownloader.cs to skip prompts
7070
shell: pwsh
7171
run: |
72-
$path = "SecretLabDependenciesBuilder/SecretLabDependenciesBuilder/ServerDownloader.cs"
73-
$content = Get-Content $path
74-
$patternStart = 'public static async Task RunAsync\(\)'
75-
$startIndex = $content.FindIndex({ $_ -match $patternStart })
76-
if ($startIndex -lt 0) { throw "Start pattern not found." }
77-
78-
$braceCount = 0
79-
for ($i = $startIndex; $i -lt $content.Count; $i++) {
80-
$line = $content[$i]
81-
$braceCount += ($line -split '{').Count - 1
82-
$braceCount -= ($line -split '}').Count - 1
83-
if ($braceCount -eq 0 -and $i -ne $startIndex) {
84-
$endIndex = $i
85-
break
86-
}
87-
}
88-
$replacement = @'
72+
(Get-Content "SecretLabDependenciesBuilder/SecretLabDependenciesBuilder/ServerDownloader.cs") -replace 'public static async Task RunAsync\(\)\s*\{[^}]*\}', @'
8973
public static async Task RunAsync()
90-
{
74+
{
9175
ConsoleWriter.WriteTitle();
9276
_beta = Environment.GetEnvironmentVariable("SL_BETA") ?? "";
9377
_betaPassword = Environment.GetEnvironmentVariable("SL_BETA_PASSWORD") ?? "";
@@ -98,7 +82,7 @@ jobs:
9882
List<string> args = [ "-app", "996560", "-filelist", filesPath, "-dir", installationDirectory.FullName ];
9983
if (!string.IsNullOrEmpty(_beta)) {
10084
args.Add("-beta"); args.Add(_beta);
101-
if (!string.IsNullOrEmpty(_betaPassword)) {
85+
if (!string.IsNullOrEmpty(_betaPassword)) {
10286
args.Add("-betapassword"); args.Add(_betaPassword);
10387
}
10488
}
@@ -111,9 +95,7 @@ jobs:
11195
AssembliesPublicizer.RunPublicizer(managedDirectory);
11296
installationDirectory.Delete(true);
11397
}
114-
'@ -split "`n"
115-
$newContent = $content[0..($startIndex - 1)] + $replacement + $content[($endIndex + 1)..($content.Count - 1)]
116-
Set-Content -Path $path -Value $newContent
98+
'@ | Set-Content "SecretLabDependenciesBuilder/SecretLabDependenciesBuilder/ServerDownloader.cs"
11799
118100
- name: Build SecretLabDependenciesBuilder
119101
run: |

0 commit comments

Comments
 (0)