1
- name : File Size Check
2
- # Trigger the workflow on PRs to the main branch. It builds the extension in prod mode and checks the size of the
3
- # vsix file and webview bundle file and compares it with the main branch. It fails if the size has increased by more than 10%.
4
- # For vsix, we also check if the size is greater than 25MB.
1
+ name : PR Checks
2
+ # Trigger the workflow on PRs to the main branch.
3
+ # It performs the following checks:
4
+ # 1. Calculate the size difference between the webview bundles of the main branch and the PR branch.
5
+ # 2. Calculate the size difference between the VSIX files of the main branch and the PR branch.
6
+ # 3. Does a check if the PR has properly localized strings.
5
7
6
8
on :
7
9
pull_request :
@@ -119,21 +121,14 @@ jobs:
119
121
body-includes : |
120
122
### VSIX Size Comparison
121
123
122
- - name : Create comment
124
+ - name : Create or update comment
123
125
if : steps.fc.outputs.comment-id == ''
124
126
uses : peter-evans/create-or-update-comment@v4
125
127
with :
126
128
token : ${{ secrets.GITHUB_TOKEN }}
127
129
issue-number : ${{ github.event.pull_request.number }}
128
130
body-path : ./results.md
129
-
130
- - name : Update comment
131
- if : steps.fc.outputs.comment-id != ''
132
- uses : peter-evans/create-or-update-comment@v4
133
- with :
134
- token : ${{ secrets.GITHUB_TOKEN }}
135
131
comment-id : ${{ steps.fc.outputs.comment-id }}
136
- body-path : ./results.md
137
132
edit-mode : replace
138
133
139
134
- name : Fail if vsix size is increased by 5% or size is above 25mb
@@ -144,6 +139,63 @@ jobs:
144
139
if : ${{ env.webview_bundle_percentage_change > 5 }}
145
140
run : exit 1
146
141
142
+ - name : Check for localized strings
143
+ run : |
144
+ cd pr
145
+ yarn localization
146
+
147
+ # Check if there are git changes in english xlf files
148
+ - name : Check for changes in english xlf files
149
+ run : |
150
+ cd pr
151
+ if git diff --exit-code --name-only origin/main -- src/localization/xliff/vscode-mssql.xlf
152
+ then
153
+ echo "No changes in english xlf files"
154
+ echo "loc_check=true" >> $GITHUB_ENV
155
+ else
156
+ echo "Changes in english xlf files"
157
+ echo "loc_check=false" >> $GITHUB_ENV
158
+ fi
159
+
160
+ - name : Find comment
161
+ if : ${{ env.loc_check == 'false' }}
162
+ uses : peter-evans/find-comment@v3
163
+ id : loc-comment
164
+ with :
165
+ issue-number : ${{ github.event.pull_request.number }}
166
+ comment-author : ' github-actions[bot]'
167
+ body-includes : |
168
+ ### Updates to localized strings required
169
+
170
+ - name : Create or update comment
171
+ if : ${{ env.loc_check == 'false' }} && steps.loc-comment.outputs.comment-id == ''
172
+ uses : peter-evans/create-or-update-comment@v4
173
+ with :
174
+ comment-id : ${{ steps.loc-comment.outputs.comment-id }}
175
+ token : ${{ secrets.GITHUB_TOKEN }}
176
+ issue-number : ${{ github.event.pull_request.number }}
177
+ body : |
178
+ # Updates to localized strings required
179
+ Please update the localized strings in the PR with following steps :
180
+ 1. Run `yarn localization` in the PR branch.
181
+ 1. Based on the changes,
182
+ * 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.
183
+ * If there are changes in localized strings in `package.nls.json`, make sure that `src/localization/xliff/vscode-mssql.xlf` is updated.
184
+ edit-mode : replace
185
+
186
+ - name : Delete comment
187
+ if : ${{ env.loc_check == 'true' }} && steps.loc-comment.outputs.comment-id != ''
188
+ run : |
189
+ curl -X DELETE \
190
+ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
191
+ -H "Accept: application/vnd.github.v3+json" \
192
+ https://api.github.com/repos/${{ github.repository }}/issues/comments/${{ steps.loc-comment.outputs.comment-id }}
193
+
194
+
195
+ - name : Fail if there are changes in english xlf files
196
+ if : ${{ env.loc_check == 'false' }}
197
+ run : exit 1
198
+
147
199
148
200
149
201
0 commit comments