Adding checks for loc strings (#18032)
This commit is contained in:
Родитель
520ca4fa4d
Коммит
381f1d6d24
|
@ -1,7 +1,9 @@
|
|||
name: File Size Check
|
||||
# Trigger the workflow on PRs to the main branch. It builds the extension in prod mode and checks the size of the
|
||||
# vsix file and webview bundle file and compares it with the main branch. It fails if the size has increased by more than 10%.
|
||||
# For vsix, we also check if the size is greater than 25MB.
|
||||
name: PR Checks
|
||||
# Trigger the workflow on PRs to the main branch.
|
||||
# It performs the following checks:
|
||||
# 1. Calculate the size difference between the webview bundles of the main branch and the PR branch.
|
||||
# 2. Calculate the size difference between the VSIX files of the main branch and the PR branch.
|
||||
# 3. Does a check if the PR has properly localized strings.
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
@ -9,7 +11,7 @@ on:
|
|||
- main
|
||||
|
||||
jobs:
|
||||
size-check:
|
||||
pr-checks:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -119,21 +121,14 @@ jobs:
|
|||
body-includes: |
|
||||
### VSIX Size Comparison
|
||||
|
||||
- name: Create comment
|
||||
- name: Create or update comment
|
||||
if: steps.fc.outputs.comment-id == ''
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body-path: ./results.md
|
||||
|
||||
- name: Update comment
|
||||
if: steps.fc.outputs.comment-id != ''
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||
body-path: ./results.md
|
||||
edit-mode: replace
|
||||
|
||||
- name: Fail if vsix size is increased by 5% or size is above 25mb
|
||||
|
@ -144,7 +139,56 @@ jobs:
|
|||
if: ${{ env.webview_bundle_percentage_change > 5 }}
|
||||
run: exit 1
|
||||
|
||||
- name: Generate xliff files in PR branch
|
||||
run: |
|
||||
cd pr
|
||||
yarn localization
|
||||
|
||||
# Check if there are git changes in english xlf files
|
||||
- name: Check for changes in english xlf files
|
||||
run: |
|
||||
cd pr
|
||||
if git diff --quiet --exit-code ./localization/xliff/vscode-mssql.xlf; then
|
||||
echo "Changes not found in english xlf files"
|
||||
echo "loc_update_required=false" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Changes found in english xlf files"
|
||||
echo "loc_update_required=true" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Find comment
|
||||
uses: peter-evans/find-comment@v3
|
||||
id: loc-comment
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-author: 'github-actions[bot]'
|
||||
body-includes: |
|
||||
# Updates to localized strings required
|
||||
|
||||
- name: Create or update comment
|
||||
if: ${{ env.loc_update_required == 'true' }}
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
comment-id: ${{ steps.loc-comment.outputs.comment-id }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
# Updates to localized strings required
|
||||
Please update the localized strings in the PR with following steps:
|
||||
1. Run `yarn localization` in the PR branch.
|
||||
1. Based on the changes,
|
||||
* If there are changes in localized strings in source code, make sure that `src/localization/xliff/vscode-mssql.xlf` and `src/l10n/bundle.l10n.json` files are updated.
|
||||
* If there are changes in localized strings in `package.nls.json`, make sure that `src/localization/xliff/vscode-mssql.xlf` is updated.
|
||||
edit-mode: replace
|
||||
|
||||
- name: Delete comment
|
||||
if: ${{ env.loc_update_required == 'false' }} && steps.loc-comment.outputs.comment-id != ''
|
||||
run: |
|
||||
curl -X DELETE \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
https://api.github.com/repos/${{ github.repository }}/issues/comments/${{ steps.loc-comment.outputs.comment-id }}
|
||||
|
||||
- name: Fail if there are changes required in english xlf files
|
||||
if: ${{ env.loc_update_required == 'true' }}
|
||||
run: exit 1
|
|
@ -18,7 +18,6 @@ coverage
|
|||
coverage-remapped
|
||||
test-reports
|
||||
.vscode-test
|
||||
localization/i18n/
|
||||
src/constants/localizedConstants.ts
|
||||
package.nls.*.json
|
||||
/test-results/
|
||||
|
|
|
@ -1046,6 +1046,9 @@
|
|||
<trans-unit id="mssql.queryHistoryLimit">
|
||||
<source xml:lang="en">Number of query history entries to show in the Query History view</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mssql.openExecutionPlanFile">
|
||||
<source xml:lang="en">Open Execution Plan File</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mssql.openQueryHistory">
|
||||
<source xml:lang="en">Open Query</source>
|
||||
</trans-unit>
|
||||
|
|
Загрузка…
Ссылка в новой задаче