diff --git a/eng/common/pipelines/templates/archetype-typespec-emitter.yml b/eng/common/pipelines/templates/archetype-typespec-emitter.yml index d0a83041cdab..d3770c797e37 100644 --- a/eng/common/pipelines/templates/archetype-typespec-emitter.yml +++ b/eng/common/pipelines/templates/archetype-typespec-emitter.yml @@ -304,6 +304,11 @@ extends: - job: Initialize steps: - checkout: self + + - template: /eng/common/pipelines/templates/steps/login-to-github.yml + parameters: + TokenOwners: + - Azure - task: UseNode@1 displayName: 'Install Node.js' @@ -355,7 +360,7 @@ extends: - template: /eng/common/pipelines/templates/steps/git-push-changes.yml parameters: - BaseRepoOwner: azure-sdk + BaseRepoOwner: Azure TargetRepoName: $(Build.Repository.Name) BaseRepoBranch: $(branchName) CommitMsg: Regenerate repository SDK with TypeSpec build $(Build.BuildNumber) @@ -363,6 +368,7 @@ extends: ScriptDirectory: $(Build.SourcesDirectory)/eng/common/scripts # To accomodate scheduled runs and retries, we want to overwrite any existing changes on the branch PushArgs: --force + AuthToken: $(GH_TOKEN) - task: PowerShell@2 displayName: Get generation job matrix @@ -390,13 +396,17 @@ extends: matrix: $[dependencies.Initialize.outputs['generate_matrix.matrix']] variables: matrixArtifactsPath: $(Pipeline.Workspace)/matrix_artifacts - AzureSdkRepoName: $[format('azure-sdk/{0}', split(variables['Build.Repository.Name'], '/')[1])] emitterNpmrcPath: $(Agent.TempDirectory)/${{ parameters.EmitterPackagePath }}/.npmrc steps: - checkout: self + + - template: /eng/common/pipelines/templates/steps/login-to-github.yml + parameters: + TokenOwners: + - Azure + - pwsh: | - git remote add azure-sdk https://github.com/$(AzureSdkRepoName).git - git fetch azure-sdk $(branchName) + git fetch origin $(branchName) git switch $(branchName) displayName: 'Checkout PR branch $(branchName)' @@ -428,12 +438,13 @@ extends: - template: /eng/common/pipelines/templates/steps/git-push-changes.yml parameters: - BaseRepoOwner: azure-sdk + BaseRepoOwner: Azure TargetRepoName: $(Build.Repository.Name) BaseRepoBranch: $(branchName) CommitMsg: Update SDK code $(JobKey) WorkingDirectory: $(Build.SourcesDirectory) ScriptDirectory: $(Build.SourcesDirectory)/eng/common/scripts + AuthToken: $(GH_TOKEN) - job: Create_PR displayName: Create PR @@ -447,6 +458,11 @@ extends: steps: - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml + - template: /eng/common/pipelines/templates/steps/login-to-github.yml + parameters: + TokenOwners: + - Azure + - pwsh: | $generateJobResult = '$(generateJobResult)' $emitterVersion = '$(emitterVersion)' @@ -532,9 +548,9 @@ extends: -RepoOwner '$(RepoOwner)' -RepoName '$(RepoName)' -BaseBranch '$(pullRequestTargetBranch)' - -PROwner 'azure-sdk' + -PROwner 'Azure' -PRBranch '$(branchName)' - -AuthToken '$(azuresdk-github-pat)' + -AuthToken '$(GH_TOKEN)' -PRTitle '$(PullRequestTitle)' -PRBody '$(PullRequestBody)' -OpenAsDraft $$(OpenAsDraft) diff --git a/eng/common/pipelines/templates/jobs/prepare-pipelines.yml b/eng/common/pipelines/templates/jobs/prepare-pipelines.yml index 46d2d0babb7f..f8523ad59983 100644 --- a/eng/common/pipelines/templates/jobs/prepare-pipelines.yml +++ b/eng/common/pipelines/templates/jobs/prepare-pipelines.yml @@ -39,6 +39,9 @@ jobs: APIReview_AutoCreate_Configurations: 93 steps: + - ${{ if endsWith(parameters.Repository, '-pr') }}: + - template: /eng/common/pipelines/templates/steps/login-to-github.yml + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml parameters: Repositories: @@ -52,7 +55,7 @@ jobs: - '!sdk/**/SessionRecords/*' - '!sdk/**/session-records/*' ${{ if endsWith(parameters.Repository, '-pr') }}: - TokenToUseForAuth: $(azuresdk-github-pat) + TokenToUseForAuth: $(GH_TOKEN) - template: /eng/common/pipelines/templates/steps/install-pipeline-generation.yml - template: /eng/common/pipelines/templates/steps/set-default-branch.yml