Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions eng/common/pipelines/templates/steps/login-to-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Will output a variable named GH_TOKEN_<Owner> for each owner in TokenOwners if there is only one owner it will just output GH_TOKEN

parameters:
- name: TokenOwners
type: object
default:
- Azure
- name: VariableNamePrefix
type: string
default: GH_TOKEN
- name: ExportAsOutputVariable
type: boolean
default: false
- name: ScriptDirectory
default: eng/common/scripts

steps:
- task: AzureCLI@2
name: GenerateGitHubToken
displayName: "Login to GitHub"
inputs:
azureSubscription: 'AzureSDKEngKeyVault Secrets'
scriptType: pscore
scriptLocation: scriptPath
scriptPath: ${{ parameters.ScriptDirectory }}/login-to-github.ps1
arguments: >
-InstallationTokenOwners '${{ join(''',''', parameters.TokenOwners) }}'
-VariableNamePrefix '${{ parameters.VariableNamePrefix }}'
-ExportAsOutputVariable:$${{ parameters.ExportAsOutputVariable }}
12 changes: 10 additions & 2 deletions eng/pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,16 @@ extends:
command: custom
customCommand: run build
workingDir: $(Build.SourcesDirectory)/autorest.csharp/src/TypeSpec.Extension/Emitter.Csharp
- template: /eng/common/pipelines/templates/steps/login-to-github.yml
parameters:
TokenOwners:
- Azure
- ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))}}:
- pwsh: >
./eng/PublishRelease.ps1
-AutorestArtifactDirectory ./artifacts/bin/AutoRest.CSharp/Release/net9.0/
-TypeSpecEmitterDirectory ./src/TypeSpec.Extension/Emitter.Csharp
-GitHubToken $(azuresdk-github-pat)
-GitHubToken $(GH_TOKEN)
-NpmToken $(azure-sdk-npm-token)
-BuildNumber $(Build.BuildNumber)
-Sha $(Build.SourceVersion)
Expand Down Expand Up @@ -249,6 +253,10 @@ extends:
Write-Host "Setting variable PrTitle to '$prTitle'"
Write-Host "##vso[task.setvariable variable=PrTitle]$prTitle"
displayName: 'Build PR Title'
- template: /eng/common/pipelines/templates/steps/login-to-github.yml
parameters:
TokenOwners:
- Azure
- task: PowerShell@2
displayName: Create pull request
inputs:
Expand All @@ -260,6 +268,6 @@ extends:
-BaseBranch "main"
-PROwner "azure-sdk"
-PRBranch $(BranchName)
-AuthToken "$(azuresdk-github-pat)"
-AuthToken "$(GH_TOKEN)"
-PRTitle "$(PrTitle)"
-PRBody "Update AutoRest C# version to $(AutorestCSharpVersion)"
3 changes: 2 additions & 1 deletion eng/pipelines/sdk-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ extends:
Write-Host "Setting variable PrTitle to '$prTitle'"
Write-Host "##vso[task.setvariable variable=PrTitle]$prTitle"
displayName: 'Build PR Title'
- template: /eng/common/pipelines/templates/steps/login-to-github.yml
- task: PowerShell@2
displayName: Create pull request
inputs:
Expand All @@ -225,7 +226,7 @@ extends:
-BaseBranch "main"
-PROwner "azure-sdk"
-PRBranch "$(BranchName)"
-AuthToken "$(azuresdk-github-pat)"
-AuthToken "$(GH_TOKEN)"
-PRTitle "$(PrTitle)"
-PRBody "Triggered from $(PRUrl.PRUrl)"
-OpenAsDraft $true
Expand Down
Loading