Private/Get-PDKGithubFileSha.ps1
Function Get-PDKGithubFileSha { <# .SYNOPSIS Get file sha of gituhb file .PARAMETER FilePath The content path. .PARAMETER Owner Specifies the owner of the github Repository. .PARAMETER Repository Specifies the target repository name. .EXAMPLE PS C:\> Get-PDKGithubFileSha -FilePath 'Plan\DeathStar.pdf' -Owner 'dark-vador' -Repository 'Sith' .NOTES File Name : Get-PDKGithubFileSha.ps1 Author : Thomas ILLIET (contact@thomas-illiet.fr) Reference : https://developer.github.com/v3/repos/contents/ #> [CmdletBinding()] [OutputType([String])] Param( [Parameter(Mandatory=$True, Position=0)] [String]$FilePath, [Parameter(Mandatory=$True, Position=1)] [String]$Owner, [Parameter(Mandatory=$True, Position=2)] [String]$Repository ) Try { $FileObject = Get-PDKGithubFileObject @PSBoundParameters -ErrorAction Stop return $FileObject.Sha } Catch { # return error message from the function Get-PDKGithubFileObject Write-Error $_.Exception.Message } } |