diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 24acc53f4b8..893749f2a74 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -302,13 +302,6 @@ extends: runOnce: deploy: steps: - - task: PowerShell@2 - displayName: 'Get Latest Commit SHA from repo' - inputs: - targetType: filePath - filePath: '$(Pipeline.Workspace)\scripts\GetLatestCommitSHA.ps1' - arguments: '-repo "msgraph-sdk-dotnet" -owner "microsoftgraph" -branchName "main"' - pwsh: true - task: PowerShell@2 displayName: 'Extract release information to pipeline' inputs: diff --git a/scripts/GetLatestCommitSHA.ps1 b/scripts/GetLatestCommitSHA.ps1 deleted file mode 100644 index f8bd19aedfd..00000000000 --- a/scripts/GetLatestCommitSHA.ps1 +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. - -<# -.Synopsis - Gets the latest commit SHA for the repository. -.Description - Uses the GitHub API and the owner name, the repository name, and the branch name - to get the latest commit SHA and set its value to an environment variable named - LATEST_COMMIT_SHA in an Azure DevOps release environment. -.Parameter owner - Specifies the owner of the repo. -.Parameter repo - Specifies the name of the repository. -.Parameter branchName - Specifies the target branch name. The default value is 'master'. -#> - -Param( - [string]$owner, - [string]$repo, - [string]$branchName = "main" -) - -if ([string]::IsNullOrEmpty($owner)) { - Write-Error "owner cannot be empty." - EXIT 1 -} - -if ([string]::IsNullOrEmpty($repo)) { - Write-Error "repo cannot be empty." - EXIT 1 -} - -Write-Host "Getting the latest commit SHA for $($branchName):" -ForegroundColor Magenta - -$latestCommitUrl = "https://api.github.com/repos/$($owner)/$($repo)/commits/$($branchName)" - -Write-Host "Getting latest commit with '$($latestCommitUrl)'" -ForegroundColor Blue -$latestCommitData = Invoke-RestMethod -Uri $latestCommitUrl -Method Get - -if ($latestCommitData.Count -eq 0) { - Write-Host "Unable to get latest commit with '$($latestCommitUrl)'" -ForegroundColor Red - EXIT 1; -} - -if ([string]::IsNullOrEmpty($latestCommitData.sha)) { - Write-Host "SHA is not present in the latest commit that is fetched" -ForegroundColor Red - Write-Host "Latest Commit Data:" -ForegroundColor Cyan - Write-Host -Object $latestCommitData -ForegroundColor Cyan - EXIT 1; -} - -Write-Host "Latest Commit SHA is '$($latestCommitData.sha)'" -ForegroundColor Green - -Write-Host "##vso[task.setvariable variable=LATEST_COMMIT_SHA]$($latestCommitData.sha)" - -Write-Host "Updated the LATEST_COMMIT_SHA environment variable with the latest commit SHA." -ForegroundColor Green \ No newline at end of file