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 b494a3f commit ff39960
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/publish-krewplugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,29 @@ jobs:
continue
}

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

# 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 after the marker
# Add the function call marker without the comment
$newLines += "`n# MARKER: FUNCTION CALL"
$newLines += "`nInvoke-KubeTidy \$PSBoundParameters"


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

Expand Down

0 comments on commit ff39960

Please sign in to comment.