Skip to content

Commit

Permalink
Refactor publish-krewplugin.yaml to update Invoke-KubeTidy function a…
Browse files Browse the repository at this point in the history
…nd modify param block

Signed-off-by: PixelRobots <22979170+PixelRobots@users.noreply.github.com>
  • Loading branch information
PixelRobots committed Oct 1, 2024
1 parent ff39960 commit 3ccc760
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions .github/workflows/publish-krewplugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,22 @@ jobs:
continue
}

# Comment out or remove the existing param block
if ($line -match 'param\s*\(' -and $insideParamBlock) {
$newLines += "# $line" # Comment out the line
continue
# Comment out the existing param block if found
if ($line -match '# START PARAM BLOCK') {
continue # Skip adding this line
}
if ($line -match '# END PARAM BLOCK') {
continue # Skip adding this line
}

# Add the line to newLines if it is not part of the removed param block
$newLines += $line

# Check for the start of the existing param block to set the flag
if ($line -match 'param\s*\(') {
$insideParamBlock = $true
}

# Check for the end of the existing param block
if ($line -match '\)') {
$insideParamBlock = $false
}
}

# Add the function call marker without the comment
# Add the function call line directly
$newLines += "`n# MARKER: FUNCTION CALL"

$newLines += "Invoke-KubeTidy \$PSBoundParameters"

# Write the updated content back to the file
Set-Content -Path $destinationFile -Value $newLines -Force

Expand Down

0 comments on commit 3ccc760

Please sign in to comment.