Public/Update-CCReleaseWorkflow.ps1
|
function Update-CCReleaseWorkflow { <# .SYNOPSIS Re-syncs the CodeCompass-managed workflow files to the current templates. .DESCRIPTION Overwrites a managed workflow only if it is unchanged since CodeCompass wrote it; user-edited and 'adopted' workflows are left untouched unless -Force. Supports -WhatIf. -PullRequest applies the update by a pull request and leaves the working tree as it is. It works from what the remote has on the default branch, in a worktree of its own. It opens nothing where the workflows are current, and nothing where a pull request from the branch is open. The result says which: Action is Current, Opened or AlreadyOpen, with the Url and the Number of the pull request, the Files, and the TemplateVersion the update is rendered from. The weekly freshness check runs it, with a token that may write workflow files: the token a workflow run is given may not. .EXAMPLE Update-CCReleaseWorkflow -Path . .EXAMPLE Update-CCReleaseWorkflow -Path . -PullRequest #> [CmdletBinding(SupportsShouldProcess)] [OutputType([pscustomobject])] param( [Parameter(Position = 0)] [string]$Path = '.', [switch]$Force, [switch]$Adopt, [switch]$PullRequest, [string]$Branch = 'codecompass/update-release-workflows' ) if ($PullRequest) { return Invoke-CCWorkflowPullRequest -Path $Path -Branch $Branch -Purpose Update -Force:$Force -Cmdlet $PSCmdlet } Invoke-CCWorkflowSync -Path $Path -Force:$Force -Adopt:$Adopt -Cmdlet $PSCmdlet } |