File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 - uses : actions/setup-node@v1
1212 - run : yarn install
1313
14- - name : Dump GitHub context
15- env :
16- GITHUB_CONTEXT : ${{ toJSON(github) }}
17- run : echo "$GITHUB_CONTEXT"
18- - name : Dump job context
19- env :
20- JOB_CONTEXT : ${{ toJSON(job) }}
21- run : echo "$JOB_CONTEXT"
22- - name : Dump steps context
23- env :
24- STEPS_CONTEXT : ${{ toJSON(steps) }}
25- run : echo "$STEPS_CONTEXT"
26- - name : Dump runner context
27- env :
28- RUNNER_CONTEXT : ${{ toJSON(runner) }}
29- run : echo "$RUNNER_CONTEXT"
30- - name : Dump strategy context
31- env :
32- STRATEGY_CONTEXT : ${{ toJSON(strategy) }}
33- run : echo "$STRATEGY_CONTEXT"
34- - name : Dump matrix context
35- env :
36- MATRIX_CONTEXT : ${{ toJSON(matrix) }}
37- run : echo "$MATRIX_CONTEXT"
38-
39- # Update all the translation issues on a nightly basis
4014 - run : yarn danger ci
4115 env :
4216 DANGER_GITHUB_API_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43- AZURE_TRANSLATION_SUB_KEY : ${{ secrets.AZURE_TRANSLATION_SUB_KEY }}
17+ AZURE_TRANSLATE_KEY : ${{ secrets.AZURE_TRANSLATE_KEY }}
Original file line number Diff line number Diff line change 1- // const markdownTranslate = require('markdown-translator')
2- // markdownTranslate({
3- // src: pathToSrcFile,
4- // from: languageToTranslateFrom,
5- // to: languageToTranslateTo,
6- // subscriptionKey: yourSubscriptionKey,
7- // region: theRegionOfYourAzureInstance
8- // }).then(res => {
9-
10- // })
11-
1+ const markdownTranslate = require ( '@orta/markdown-translator' )
122import { danger , message } from "danger"
133
14- const allFiles = [ ...danger . git . created_files , ...danger . git . created_files ]
15- message ( allFiles . join ( ", " ) )
4+ const go = async ( ) => {
5+ const allMDFiles = [ ...danger . git . modified_files , ...danger . git . created_files ] . filter ( f => f . endsWith ( ".md" ) ) . filter ( f => f . split ( "/" ) . length > 2 )
6+ console . log ( allMDFiles )
7+ for ( const file of allMDFiles ) {
8+ const fileContents = await danger . github . utils . fileContents ( file )
9+ const translation = await markdownTranslate ( {
10+ text : fileContents ,
11+ from : file . split ( "/" ) [ 2 ] ,
12+ to : "en" ,
13+ subscriptionKey : process . env . AZURE_TRANSLATE_KEY ,
14+ region : "eastus"
15+ } )
16+
17+ message ( `Translation of ${ danger . github . utils . fileLinks ( [ file ] ) } \n\n${ translation } ` )
18+ } ;
19+ }
20+
21+ go ( )
Original file line number Diff line number Diff line change 1111 "test" : " yarn validate-paths"
1212 },
1313 "dependencies" : {
14+ "@orta/markdown-translator" : " ^0.4.2" ,
1415 "@oss-docs/sync" : " *" ,
15- "danger" : " ^10.6.0" ,
16- "markdown-translator" : " ^0.4.2"
16+ "danger" : " ^10.6.0"
1717 }
1818}
Original file line number Diff line number Diff line change 120120 " @octokit/openapi-types" " ^3.2.0"
121121 " @types/node" " >= 8"
122122
123+ " @orta/markdown-translator@^0.4.2 " :
124+ version "0.4.3"
125+ resolved "https://registry.yarnpkg.com/@orta/markdown-translator/-/markdown-translator-0.4.3.tgz#3e8e453ce3a0fa6cd77c33333578b4a7877ac1cd"
126+ integrity sha512-RM0hjJ9YvtpVKPFi8iWbATofuSlrD4R/7zpbh4Qpb/Jo0s9GY+vR9GiprvLLyxMX86CzfirEJIWaXVjv3ZTypA==
127+ dependencies :
128+ commander "^5.0.0"
129+ lodash.chunk "^4.2.0"
130+ lodash.flatten "^4.4.0"
131+ lodash.merge "^4.6.1"
132+ remark "^12.0.0"
133+ request "^2.88.0"
134+ unified-stream "^1.0.4"
135+
123136" @oss-docs/sync@* " :
124137 version "1.0.0"
125138 resolved "https://registry.yarnpkg.com/@oss-docs/sync/-/sync-1.0.0.tgz#72bf1a7bd7bee3dd543558d658e32f4928d45601"
@@ -1477,19 +1490,6 @@ markdown-table@^2.0.0:
14771490 dependencies :
14781491 repeat-string "^1.0.0"
14791492
1480- markdown-translator@^0.4.2 :
1481- version "0.4.2"
1482- resolved "https://registry.yarnpkg.com/markdown-translator/-/markdown-translator-0.4.2.tgz#82480ebc6b46be3031bed4fd5f27d489230beb8f"
1483- integrity sha512-EVC/eqG32BDnu9onmmaCeOKJoRvvdgdGMezCsbzEBoMwq8WuQ7gotdvjeljdnOeI2/gZwZ4o8MpE2Qo8KTQJ4A==
1484- dependencies :
1485- commander "^5.0.0"
1486- lodash.chunk "^4.2.0"
1487- lodash.flatten "^4.4.0"
1488- lodash.merge "^4.6.1"
1489- remark "^12.0.0"
1490- request "^2.88.0"
1491- unified-stream "^1.0.4"
1492-
14931493mdast-util-compact@^2.0.0 :
14941494 version "2.0.1"
14951495 resolved "https://registry.yarnpkg.com/mdast-util-compact/-/mdast-util-compact-2.0.1.tgz#cabc69a2f43103628326f35b1acf735d55c99490"
You can’t perform that action at this time.
0 commit comments