From 8d435df2d39ee922ed49f073cf5ba30b2c8bd8f4 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 26 Mar 2021 10:28:32 -0700 Subject: [PATCH] Support default branch for the workflow. Part 1 (#1979) Co-authored-by: Sima Zhu --- eng/common/pipelines/templates/steps/publish-blobs.yml | 3 ++- eng/common/scripts/check-spelling-in-changed-files.ps1 | 2 +- eng/common/scripts/copy-docs-to-blobstorage.ps1 | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/eng/common/pipelines/templates/steps/publish-blobs.yml b/eng/common/pipelines/templates/steps/publish-blobs.yml index 7446c1af6..2af016786 100644 --- a/eng/common/pipelines/templates/steps/publish-blobs.yml +++ b/eng/common/pipelines/templates/steps/publish-blobs.yml @@ -8,6 +8,7 @@ parameters: RepoId: $(Build.Repository.Name) steps: +- template: /eng/common/pipelines/templates/steps/set-default-branch.yml - pwsh: | Invoke-WebRequest -MaximumRetryCount 10 -Uri "https://aka.ms/downloadazcopy-v10-windows" -OutFile "azcopy.zip" | Wait-Process; Expand-Archive -Path "azcopy.zip" -DestinationPath "$(Build.BinariesDirectory)/azcopy/" @@ -23,7 +24,7 @@ steps: -SASKey "${{ parameters.BlobSASKey }}" -BlobName "${{ parameters.BlobName }}" -PublicArtifactLocation "${{ parameters.ArtifactLocation }}" - -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)master" + -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)$(DefaultBranch)" pwsh: true workingDirectory: $(Pipeline.Workspace) displayName: Copy Docs to Blob diff --git a/eng/common/scripts/check-spelling-in-changed-files.ps1 b/eng/common/scripts/check-spelling-in-changed-files.ps1 index 8a9654d20..9d41e5b56 100644 --- a/eng/common/scripts/check-spelling-in-changed-files.ps1 +++ b/eng/common/scripts/check-spelling-in-changed-files.ps1 @@ -63,7 +63,7 @@ Uses cspell (from NPM) to check spelling of recently changed files .DESCRIPTION This script checks files that have changed relative to a base branch (default -`master`) for spelling errors. Dictionaries and spelling configurations reside +branch) for spelling errors. Dictionaries and spelling configurations reside in a configurable `cspell.json` location. This script uses `npx` and assumes that NodeJS (and by extension `npm` and `npx` diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index bc6b6c302..7864e9680 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -8,7 +8,7 @@ param ( $ExitOnError=1, $UploadLatest=1, $PublicArtifactLocation = "", - $RepoReplaceRegex = "(https://github.com/.*/(?:blob|tree)/)master" + $RepoReplaceRegex = "" ) . (Join-Path $PSScriptRoot common.ps1) @@ -199,7 +199,7 @@ function Upload-Blobs LogDebug "Final Dest $($DocDest)/$($PkgName)/$($DocVersion)" LogDebug "Release Tag $($ReleaseTag)" - # Use the step to replace master link to release tag link + # Use the step to replace default branch link to release tag link if ($ReleaseTag) { foreach ($htmlFile in (Get-ChildItem $DocDir -include *.html -r)) { @@ -211,7 +211,7 @@ function Upload-Blobs } } else { - LogWarning "Not able to do the master link replacement, since no release tag found for the release. Please manually check." + LogWarning "Not able to do the default branch link replacement, since no release tag found for the release. Please manually check." } LogDebug "Uploading $($PkgName)/$($DocVersion) to $($DocDest)..."