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 :
8
10
branches :
9
11
- main
10
12
11
13
jobs :
12
- size-check :
14
+ pr-checks :
13
15
runs-on : ubuntu-latest
14
16
permissions :
15
17
contents : read
@@ -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,7 +139,56 @@ jobs:
144
139
if : ${{ env.webview_bundle_percentage_change > 5 }}
145
140
run : exit 1
146
141
142
+ - name : Generate xliff files in PR branch
143
+ run : |
144
+ cd pr
145
+ yarn localization
147
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 --quiet --exit-code ./localization/xliff/vscode-mssql.xlf; then
152
+ echo "Changes not found in english xlf files"
153
+ echo "loc_update_required=false" >> $GITHUB_ENV
154
+ else
155
+ echo "Changes found in english xlf files"
156
+ echo "loc_update_required=true" >> $GITHUB_ENV
157
+ fi
148
158
159
+ - name : Find comment
160
+ uses : peter-evans/find-comment@v3
161
+ id : loc-comment
162
+ with :
163
+ issue-number : ${{ github.event.pull_request.number }}
164
+ comment-author : ' github-actions[bot]'
165
+ body-includes : |
166
+ # Updates to localized strings required
149
167
168
+ - name : Create or update comment
169
+ if : ${{ env.loc_update_required == 'true' }}
170
+ uses : peter-evans/create-or-update-comment@v4
171
+ with :
172
+ comment-id : ${{ steps.loc-comment.outputs.comment-id }}
173
+ token : ${{ secrets.GITHUB_TOKEN }}
174
+ issue-number : ${{ github.event.pull_request.number }}
175
+ body : |
176
+ # Updates to localized strings required
177
+ Please update the localized strings in the PR with following steps:
178
+ 1. Run `yarn localization` in the PR branch.
179
+ 1. Based on the changes,
180
+ * 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.
181
+ * If there are changes in localized strings in `package.nls.json`, make sure that `src/localization/xliff/vscode-mssql.xlf` is updated.
182
+ edit-mode : replace
150
183
184
+ - name : Delete comment
185
+ if : ${{ env.loc_update_required == 'false' }} && steps.loc-comment.outputs.comment-id != ''
186
+ run : |
187
+ curl -X DELETE \
188
+ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
189
+ -H "Accept: application/vnd.github.v3+json" \
190
+ https://api.github.com/repos/${{ github.repository }}/issues/comments/${{ steps.loc-comment.outputs.comment-id }}
191
+
192
+ - name : Fail if there are changes required in english xlf files
193
+ if : ${{ env.loc_update_required == 'true' }}
194
+ run : exit 1
0 commit comments