Skip to content

Commit 0aeeb44

Browse files
Update string translation actions, remove PAT token usage (#5314)
1 parent e322858 commit 0aeeb44

File tree

3 files changed

+36
-103
lines changed

3 files changed

+36
-103
lines changed

.github/workflows/run-td-build.yml

-62
This file was deleted.

.github/workflows/touchdown-pipeline/touchdown-build.yml

+27-33
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Touchdown build pipeline
22

3-
trigger: none
3+
trigger:
4+
branches:
5+
include:
6+
- main
47
pr: none
58

69
resources:
@@ -9,6 +12,14 @@ resources:
912
type: git
1013
name: 1ESPipelineTemplates/M365GPT
1114
ref: refs/tags/release
15+
16+
parameters:
17+
# Parameter to control whether to only pass strings to touchdown (false) or to also create a PR with changes (true)
18+
- name: commit_new_strings
19+
displayName: 'Commit strings to GitHub'
20+
type: boolean
21+
default: false
22+
1223
extends:
1324
template: v1/M365.Unofficial.PipelineTemplate.yml@m365Pipelines
1425
parameters:
@@ -51,24 +62,15 @@ extends:
5162
displayName: 'Call Touchdown build task for composites and commit changes'
5263

5364
- task: PowerShell@2
54-
displayName: Push changes to repo
65+
displayName: Commit changes to a new branch
66+
condition: eq('${{ parameters.commit_new_strings }}', true) # Only create a PR if the parameter is set to true
5567
inputs:
5668
targetType: 'inline'
5769
script: |
5870
# ------------------------------------------------------------------------------------------------
59-
# - Script to push changes
71+
# - Script to create a new branch in the GitHub repo with string changes
6072
# ------------------------------------------------------------------------------------------------
6173
62-
$teamProject = $env:SYSTEM_TEAMPROJECT
63-
$repoName= $env:Build_Repository_Name
64-
$pipelineName = $env:Build_DefinitionName
65-
66-
Write-host "Azure DevOps organization: $env:System_TeamFoundationCollectionUri"
67-
Write-host "Team Project: $teamProject"
68-
Write-host "Repo Name: $repoName"
69-
Write-host "Source Branch: $(Build.SourceBranch)"
70-
71-
7274
if ("$(git status)".Contains("nothing to commit")) {
7375
Write-Host "Nothing to commit, exiting immediately"
7476
Exit
@@ -79,33 +81,25 @@ extends:
7981
#****************************************
8082
Write-Host "##[group] Configure GIT"
8183
82-
#Setting Global Git Username and Email. NOTE: Branch will be created as this user
84+
# Setting Global Git Username and Email. NOTE: Branch will be created as this user
8385
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
8486
git config user.name "github-actions[bot]"
8587
86-
#**********************************************
87-
#***Checkout current branch and push changes***
88-
#**********************************************
89-
90-
Write-Host "##[group] Checkout current branch and push changes"
91-
#Create Branch and add changes
88+
#**************************************************
89+
#*** Create a new branch and push changes to it ***
90+
#**************************************************
9291
93-
Write-Host "Checkout current branch"
92+
# Get the current date and time in the format yyyyMMdd-HHmmss
93+
$dateTime = Get-Date -Format "yyyyMMdd-HHmmss"
94+
$newBranchName = "td/update-strings-$dateTime"
9495
95-
$branchName = "$(Build.SourceBranch)"
96-
$branchName = $branchName -replace "refs/heads/", ""
97-
98-
git checkout $branchName
96+
Write-Host "Creating new branch $newBranchName"
97+
git checkout -b $newBranchName
9998
git add -A
100-
git commit -m "TDBuild latest localization" -a
101-
git push origin $branchName
99+
git commit -m "TDBuild latest localization"
100+
git push origin $newBranchName
102101
103-
if (!$?) {
104-
# We ignore stderr (in task definition) due to git loving to write there even when things are fine.
105-
Write-Host "The git push command failed. Exiting."
106-
Exit 1
107-
}
108-
condition: eq(variables['commit'], 'true')
102+
Write-Host "PR created successfully: $($response.url)"
109103
sdl:
110104
arrow:
111105
serviceConnection: Arrow_skype_PROD

docs/references/string-translations.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22

33
[@azure/communication-react](https://www.npmjs.com/package/@azure/communication-react) includes translations of all strings used internally to a set of supported languages.
44

5-
We use a Microsoft internal translation service for string translations. Strings are automatically sent for translation via a [GitHub action](https://github.com/Azure/communication-ui-library/actions/workflows/run-td-build.yml) on pushes to the `main`.
5+
We use a Microsoft internal translation service for string translations. Strings are automatically sent for translation when pushed to main. This is done via an internal Azure Pipeline.
66

77
**Strings are not committed back into the repository automatically**. This is to avoid surprises due to mis-translated strings and so that test snapshots can be updated to reflect the new strings.
88

9-
To fetch back strings:
9+
## Pulling strings back to the repo
1010

11-
* Create a new branch off of `main` and trigger the same [GitHub action](https://github.com/Azure/communication-ui-library/actions/workflows/run-td-build.yml).
12-
* Pick your new branch to run the workflow and check the option to commit updated strings.
13-
![Trigger strings translation action](../images/trigger-strings-translation-and-fetch.png)
14-
* Follow the [usual process](../contributing-guide/6.%20submitting-a-pr.md) for merging the PR into `main`.
15-
* You _may_ need to add the `update_snapshots` label to the PR to update [e2e test snapshots](../references/ui-tests.md) if the e2e tests fail.
11+
To pull strings back to the repo:
1612

17-
**Note**: String translation can take up to 5 working days to complete. Be careful when making (i.e., cherry-picking into a release branch) string changes close to a release.
13+
- Run the internal Azure pipeline manually and select `Commit strings to GitHub`.
14+
- This will create a branch called `td/new-strings-<datetime>` with the new strings.
15+
- This pipeline can br run off any branch and the strings will be translated from that branch. We typically run it off `main` or a `release` branch.
16+
- Then create a PR to merge this branch into your desired branch.
17+
18+
## References
1819

1920
Further reading: [Internal documentation](https://skype.visualstudio.com/SPOOL/_wiki/wikis/SPOOL.wiki/25949/Localization) for details on how string translation service is setup.

0 commit comments

Comments
 (0)