Skip to content

Commit ab08a9a

Browse files
Replace azuresdk-github-pat with GH_TOKEN in Azure pipeline YAML files (#43468)
* Replace azuresdk-github-pat with GH_TOKEN in scoped YAML files Agent-Logs-Url: https://github.com/Azure/azure-rest-api-specs/sessions/d20ae825-bf04-497b-bbda-497c1f39b93d Co-authored-by: chidozieononiwu <31145988+chidozieononiwu@users.noreply.github.com> Spec change so PR pipelines are triggered Update loging-to-github.yml call Avoid login-to-github.yml on PR runs * Move login-to-github after chekout step --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Chidozie Ononiwu <chononiw@microsoft.com>
1 parent 491ca87 commit ab08a9a

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

eng/pipelines/swagger-api-doc-preview.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,24 @@ jobs:
3232
value: 'Swagger ApiDocPreview'
3333

3434
steps:
35+
- checkout: self
36+
# Fetch depth required to get list of changed files
37+
fetchDepth: 2
38+
39+
- template: /eng/common/pipelines/templates/steps/login-to-github.yml
40+
3541
- template: /eng/pipelines/templates/steps/set-sha-check.yml
3642
parameters:
3743
State: pending
3844
TargetUrl: $(CurrentBuildUrl)
3945
Description: 'Starting docs build'
4046
Context: $(StatusName)
41-
42-
- checkout: self
43-
# Fetch depth required to get list of changed files
44-
fetchDepth: 2
47+
GitHubToken: $(GH_TOKEN)
4548

4649
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
4750
parameters:
4851
SkipCheckoutNone: true
49-
TokenToUseForAuth: $(azuresdk-github-pat)
52+
TokenToUseForAuth: $(GH_TOKEN)
5053
# Path does not need to be set because sparse-checkout.yml already
5154
# checks out files in the repo root
5255
Repositories:

eng/pipelines/templates/steps/set-sha-check.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ parameters:
4242

4343
- name: GitHubToken
4444
type: string
45-
default: $(azuresdk-github-pat)
45+
default: ''
4646

4747
steps:
48+
- ${{ if eq(parameters.GitHubToken, '') }}:
49+
- template: /eng/common/pipelines/templates/steps/login-to-github.yml
50+
4851
- bash: |
4952
echo "Repository Name: ${{ parameters.RepositoryName }}"
5053
echo "Commit ID: ${{ parameters.Sha }}"
@@ -61,4 +64,4 @@ steps:
6164
displayName: ${{ parameters.DisplayName }}
6265
condition: ${{ parameters.Condition }}
6366
env:
64-
GH_TOKEN: ${{ parameters.GitHubToken }}
67+
GH_TOKEN: $(GH_TOKEN)

0 commit comments

Comments
 (0)