File tree Expand file tree Collapse file tree 3 files changed +56
-7
lines changed Expand file tree Collapse file tree 3 files changed +56
-7
lines changed Original file line number Diff line number Diff line change
1
+ name : Build Crowdin project
2
+
3
+ on :
4
+ schedule :
5
+ - cron : " 20 04 1 * *" # Runs at 4:20 AM on the first day of every month
6
+ workflow_dispatch :
7
+
8
+ jobs :
9
+ create_pr :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Check out code
13
+ uses : actions/checkout@v3
14
+
15
+ - name : Set up Node.js
16
+ uses : actions/setup-node@v3
17
+ with :
18
+ node-version : 18
19
+
20
+ - name : Install dependencies
21
+ run : yarn install
22
+
23
+ - name : Install ts-node
24
+ run : yarn global add ts-node
25
+
26
+ - name : Run script
27
+ run : npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/triggerBuild.ts
28
+ env :
29
+ CROWDIN_API_KEY : ${{ secrets.CROWDIN_API_KEY }}
30
+ CROWDIN_PROJECT_ID : ${{ secrets.CROWDIN_PROJECT_ID }}
Original file line number Diff line number Diff line change @@ -24,13 +24,13 @@ async function main() {
24
24
25
25
const progress = response . data . map (
26
26
( { data } ) =>
27
- ( {
28
- languageId : data . languageId ,
29
- words : {
30
- approved : data . words . approved ,
31
- total : data . words . total ,
32
- } ,
33
- } as ProjectProgressData )
27
+ ( {
28
+ languageId : data . languageId ,
29
+ words : {
30
+ approved : data . words . approved ,
31
+ total : data . words . total ,
32
+ } ,
33
+ } as ProjectProgressData )
34
34
)
35
35
36
36
fs . writeFileSync (
Original file line number Diff line number Diff line change
1
+ import crowdin from "../api-client/crowdinClient"
2
+
3
+ import "dotenv/config"
4
+
5
+ async function triggerBuild ( ) {
6
+ const projectId = Number ( process . env . CROWDIN_PROJECT_ID ) || 363359
7
+
8
+ try {
9
+ await crowdin . translationsApi . buildProject ( projectId , {
10
+ exportApprovedOnly : true ,
11
+ } )
12
+ } catch ( error : unknown ) {
13
+ console . error ( ( error as Error ) . message )
14
+ }
15
+ }
16
+
17
+ triggerBuild ( )
18
+
19
+ export default triggerBuild
You can’t perform that action at this time.
0 commit comments