Skip to content
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
18 changes: 17 additions & 1 deletion eng/common/pipelines/templates/archetype-typespec-emitter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@ extends:
- job: Initialize
steps:
- checkout: self

- template: /eng/common/pipelines/templates/steps/login-to-github.yml
parameters:
TokenOwners:
- azure-sdk

Comment on lines +308 to 312
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added login-to-github.yml step doesn't appear to be used anywhere later in the Initialize job (there are no references to GH_TOKEN* in this job). Since login-to-github.ps1 mints a GitHub App token via Key Vault signing, running it unnecessarily adds time and an external dependency for every pipeline run. Please remove it, or wire the minted token into a later step that actually requires GitHub auth in this job.

Suggested change
- template: /eng/common/pipelines/templates/steps/login-to-github.yml
parameters:
TokenOwners:
- azure-sdk

Copilot uses AI. Check for mistakes.
- task: UseNode@1
displayName: 'Install Node.js'
Expand Down Expand Up @@ -394,6 +399,12 @@ extends:
emitterNpmrcPath: $(Agent.TempDirectory)/${{ parameters.EmitterPackagePath }}/.npmrc
steps:
- checkout: self

- template: /eng/common/pipelines/templates/steps/login-to-github.yml
parameters:
TokenOwners:
- azure-sdk

Comment on lines +403 to +407
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added login-to-github.yml step doesn't appear to be used anywhere later in the Generate job (the job doesn't reference GH_TOKEN*, and pushes are performed via git-push-changes.yml which currently uses $(azuresdk-github-pat)). Running GitHub App login per matrix job can be expensive (Key Vault signing + extra REST calls) and increases the chance of transient failures. Please remove it until it is needed, or update the subsequent GitHub-authenticated operations to actually use the minted token.

Suggested change
- template: /eng/common/pipelines/templates/steps/login-to-github.yml
parameters:
TokenOwners:
- azure-sdk

Copilot uses AI. Check for mistakes.
- pwsh: |
git remote add azure-sdk https://github.com/$(AzureSdkRepoName).git
git fetch azure-sdk $(branchName)
Expand Down Expand Up @@ -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)'
Expand Down Expand Up @@ -534,7 +550,7 @@ extends:
-BaseBranch '$(pullRequestTargetBranch)'
-PROwner 'azure-sdk'
-PRBranch '$(branchName)'
-AuthToken '$(azuresdk-github-pat)'
-AuthToken '$(GH_TOKEN)'
-PRTitle '$(PullRequestTitle)'
Comment on lines 550 to 554
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create pull request is now hard-coded to use $(GH_TOKEN_Azure), but this template derives RepoOwner at runtime from Build.Repository.Name and can be azure-sdk (or something else) depending on which repo consumes this archetype. In those cases the GH_TOKEN_Azure installation token will not have permissions on the target org, and PR creation will fail with 401/403. Consider selecting the token variable based on $(RepoOwner) (e.g., set an AuthTokenForPR variable in the preceding PowerShell step by reading the appropriate GH_TOKEN* env var) and pass that into Submit-PullRequest.ps1 instead of always using GH_TOKEN_Azure.

Copilot uses AI. Check for mistakes.
-PRBody '$(PullRequestBody)'
-OpenAsDraft $$(OpenAsDraft)
Expand Down
5 changes: 4 additions & 1 deletion eng/common/pipelines/templates/jobs/prepare-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down