Skip to content

Commit df1a31e

Browse files
authored
Fix OneLoc pipeline (#64414)
1 parent 55a46f1 commit df1a31e

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

‎tools/pipelines/localization-update.yml‎

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
trigger: none
22
pr: none
33

4-
# OneLocBuild materializes packaged LCL handbacks under the artifact directory.
5-
# Its manifests map those files to their native repository paths. After applying
6-
# them, the diagnostics generator produces deterministic runtime gzip files.
7-
# The resulting changes update a stable GitHub branch and pull request.
4+
# Before OneLoc assigns an LCL package ID, this pipeline publishes the initial
5+
# localization handoff. After the package ID is configured, it applies packaged
6+
# handbacks, generates deterministic runtime gzip files, and updates a pull request.
87
schedules:
98
- cron: '0 7 * * *'
109
displayName: Daily localization update
@@ -14,6 +13,9 @@ schedules:
1413
- main
1514

1615
variables:
16+
# Fill this in after the localization team assigns the LCL package ID.
17+
- name: OneLocLclPackageId
18+
value: ''
1719
- name: TYPESCRIPT_AUTOMATION_GITHUB_APP_CLIENT_ID
1820
value: Iv23li4GolzJSEp1mzHI
1921
- name: TYPESCRIPT_AUTOMATION_GITHUB_APP_KEY_ID
@@ -52,7 +54,7 @@ jobs:
5254
- task: AzureCLI@2
5355
displayName: Create OneLocBuild token
5456
inputs:
55-
azureSubscription: devdiv-onelocbuild-ceapex
57+
azureSubscription: dnceng-onelocbuild-ceapex
5658
scriptType: pscore
5759
scriptLocation: inlineScript
5860
inlineScript: |
@@ -61,8 +63,20 @@ jobs:
6163
$token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
6264
Write-Host "##vso[task.setvariable variable=OneLocBuildToken;issecret=true]$token"
6365
66+
- task: OneLocBuild@3
67+
displayName: Generate localization handoff
68+
condition: and(succeeded(), eq(variables['OneLocLclPackageId'], ''))
69+
inputs:
70+
locProj: tools/LocProject.json
71+
outDir: $(Build.ArtifactStagingDirectory)
72+
LclSource: lclFilesInRepo
73+
packageSourceAuth: patAuth
74+
patVariable: $(OneLocBuildToken)
75+
isCreatePrSelected: false
76+
6477
- task: OneLocBuild@3
6578
displayName: Generate localized files
79+
condition: and(succeeded(), ne(variables['OneLocLclPackageId'], ''))
6680
env:
6781
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
6882
inputs:
@@ -115,12 +129,14 @@ jobs:
115129
Copy-Item -LiteralPath $source -Destination $destination -Force
116130
}
117131
displayName: Apply localized files
132+
condition: and(succeeded(), ne(variables['OneLocLclPackageId'], ''))
118133
119134
- pwsh: |
120135
$ErrorActionPreference = "Stop"
121136
$PSNativeCommandUseErrorActionPreference = $true
122137
npx hereby generate:diagnostics
123138
displayName: Generate localization artifacts
139+
condition: and(succeeded(), ne(variables['OneLocLclPackageId'], ''))
124140
125141
- task: CopyFiles@2
126142
displayName: Add localization project to handoff
@@ -140,6 +156,8 @@ jobs:
140156
azureSubscription: TypeScript-DevDiv-KeyVault
141157
repositories: TypeScript
142158
permissions: contents:write,pull_requests:write
159+
condition: and(succeeded(), ne(variables['OneLocLclPackageId'], ''))
160+
revokeCondition: and(always(), ne(variables['OneLocLclPackageId'], ''))
143161
insertSteps:
144162
- pwsh: |
145163
$ErrorActionPreference = "Stop"
@@ -194,5 +212,6 @@ jobs:
194212
gh pr create --repo microsoft/TypeScript --base main --head $branch --title "Update localization files" --body "Updates localization handbacks and their generated runtime artifacts."
195213
}
196214
displayName: Create or update localization pull request
215+
condition: and(succeeded(), ne(variables['OneLocLclPackageId'], ''))
197216
env:
198217
GH_TOKEN: $(GH_TOKEN)

‎tools/pipelines/steps/create-github-app-token.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,20 @@ parameters:
2121
- name: tokenVariable
2222
type: string
2323
default: 'GH_TOKEN'
24+
- name: condition
25+
type: string
26+
default: succeeded()
27+
- name: revokeCondition
28+
type: string
29+
default: always()
2430
- name: insertSteps
2531
type: stepList
2632
default: []
2733

2834
steps:
2935
- task: AzureCLI@2
3036
displayName: Create GitHub App token
37+
condition: ${{ parameters.condition }}
3138
inputs:
3239
azureSubscription: ${{ parameters.azureSubscription }}
3340
scriptType: pscore
@@ -605,7 +612,7 @@ steps:
605612

606613
- task: PowerShell@2
607614
displayName: Revoke GitHub App token
608-
condition: always()
615+
condition: ${{ parameters.revokeCondition }}
609616
continueOnError: true
610617
inputs:
611618
targetType: inline

0 commit comments

Comments
 (0)