Skip to content

Commit f2c1ce8

Browse files
authored
[CI] remove github pat usage (#25605)
1 parent 2ba4dae commit f2c1ce8

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

.azure-pipelines/code-gen.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ jobs:
2121
pool: pool-windows-2019
2222
steps:
2323
- checkout: self
24-
- template: util/get-github-pat-steps.yml
24+
persistCredentials: true
25+
- template: util/get-github-token-steps.yml
2526
- task: NodeTool@0
2627
displayName: Use Node 14.15.5
2728
inputs:

.azure-pipelines/util/analyze-steps.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ parameters:
55
IsGenerateBased: ''
66

77
steps:
8-
- template: get-github-pat-steps.yml
98
- template: download-build-steps.yml
109
parameters:
1110
artifactName: build-${{ parameters.testFramework }}
@@ -50,7 +49,6 @@ steps:
5049
custom: msbuild
5150
arguments: 'build.proj /t:GenerateHelp /p:Configuration=${{ parameters.configuration }};PullRequestNumber=$(System.PullRequest.PullRequestNumber)'
5251
env:
53-
OCTOKITPAT: $(GithubToken)
5452
PowerShellPlatform: ${{ parameters.powerShellPlatform }}
5553

5654
- task: DotNetCoreCLI@2
@@ -60,7 +58,6 @@ steps:
6058
custom: msbuild
6159
arguments: 'build.proj /t:StaticAnalysis /p:Configuration=${{ parameters.configuration }};PullRequestNumber=$(System.PullRequest.PullRequestNumber)'
6260
env:
63-
OCTOKITPAT: $(GithubToken)
6461
IsGenerateBased: ${{ parameters.IsGenerateBased }}
6562

6663
- template: publish-artifacts-steps.yml

.azure-pipelines/util/build-steps.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ parameters:
44
powerShellPlatform: ''
55

66
steps:
7-
- template: get-github-pat-steps.yml
7+
- checkout: self
8+
persistCredentials: true
9+
- template: get-github-token-steps.yml
810
- task: NodeTool@0
911
condition: eq(variables.IsGenerateBased, true)
1012
displayName: Install Autorest
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
steps:
2+
- task: PowerShell@2
3+
displayName: Get GitHub Token
4+
inputs:
5+
targetType: 'inline'
6+
script: |
7+
$httpConfigs = (git config --get-regexp "http" )
8+
$authConfig = $httpConfigs | Where-Object {$_ -like "*AUTHORIZATION*"}
9+
$token = ($authConfig -split ' ')[-1]
10+
$ghToken = ([System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($token)) -split ':')[1]
11+
Write-Host "##vso[task.setvariable variable=GithubToken;issecret=true]$ghToken"
12+

.azure-pipelines/util/test-steps.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ parameters:
66
powerShellPlatform: ''
77

88
steps:
9-
- template: get-github-pat-steps.yml
109
- template: download-build-steps.yml
1110
parameters:
1211
artifactName: build-${{ parameters.testFramework }}
@@ -31,7 +30,6 @@ steps:
3130
custom: msbuild
3231
arguments: 'build.proj /t:${{ parameters.testTarget }} /p:Configuration=${{ parameters.configuration }};TestFramework=${{ parameters.testFramework }};PullRequestNumber=$(System.PullRequest.PullRequestNumber)'
3332
env:
34-
OCTOKITPAT: $(GithubToken)
3533
PowerShellPlatform: ${{ parameters.powerShellPlatform }}
3634
continueOnError: true
3735

0 commit comments

Comments
 (0)