File tree 3 files changed +62
-12
lines changed
packages/typescriptlang-org/scripts
3 files changed +62
-12
lines changed Original file line number Diff line number Diff line change 13
13
14
14
steps :
15
15
- uses : actions/checkout@v1
16
+ - run : yarn install
17
+
18
+ # Update all the translation issues on a nightly basis
19
+ - run : node packages/typescriptlang-org/scripts/updateGitHubTranslationIssues.ts
20
+ env :
21
+ GITHUB_TOKEN : ${{ secrets.TS_BOT_TOKEN }}
22
+
16
23
# Setup Git
17
24
- run : git config user.name "typescript-bot"
18
25
- run : git config user.email "bot@typescriptlang.org"
21
28
env :
22
29
GITHUB_TOKEN : ${{ secrets.TS_BOT_TOKEN }}
23
30
24
- - run : git commit --no-edit -- allow-empty
31
+ - run : git commit --allow-empty -m "Nightly Deploy"
25
32
- run : git push upstream master:release -f
Original file line number Diff line number Diff line change @@ -2,15 +2,7 @@ const { join } = require("path")
2
2
const fs = require ( "fs" )
3
3
const path = require ( "path" )
4
4
5
- const lang = process . argv . slice ( 2 ) [ 0 ]
6
- if ( ! lang ) {
7
- console . log ( "You need to run this script with a language arg" )
8
- console . log (
9
- "> node packages/typescriptlang-org/scripts/makeMarkdownOfTranslations.js jp"
10
- )
11
- }
12
-
13
- const getAllTODOFiles = ( ) => {
5
+ const getAllTODOFiles = lang => {
14
6
const diffFolders = ( root , lang ) => {
15
7
const en = join ( root , "en" )
16
8
const thisLang = join ( root , lang )
@@ -111,5 +103,17 @@ const toMarkdown = files => {
111
103
return md . join ( "\n" )
112
104
}
113
105
114
- const files = getAllTODOFiles ( )
115
- console . log ( toMarkdown ( files ) )
106
+ if ( ! module . parent ) {
107
+ const lang = process . argv . slice ( 2 ) [ 0 ]
108
+ if ( ! lang ) {
109
+ console . log ( "You need to run this script with a language arg" )
110
+ console . log (
111
+ "> node packages/typescriptlang-org/scripts/makeMarkdownOfTranslations.js jp"
112
+ )
113
+ }
114
+
115
+ const files = getAllTODOFiles ( lang )
116
+ console . log ( toMarkdown ( files ) )
117
+ }
118
+
119
+ module . exports = { toMarkdown, getAllTODOFiles }
Original file line number Diff line number Diff line change
1
+ // @ts -check
2
+
3
+ const nodeFetch = require ( "node-fetch" ) . default
4
+ const { writeFileSync, readFileSync } = require ( "fs" )
5
+ const { join } = require ( "path" )
6
+ const { getAllTODOFiles, toMarkdown } = require ( "./makeMarkdownOfTranslations" )
7
+ const Octokit = require ( "@octokit/rest" )
8
+
9
+ const languages = {
10
+ ja : 220 ,
11
+ pt : 233 ,
12
+ es : 232 ,
13
+ }
14
+
15
+ const go = async ( ) => {
16
+ const octokit = Octokit ( {
17
+ auth : process . env . GITHUB_TOKEN ,
18
+ userAgent : "TS Lang Issue Updater" ,
19
+ } )
20
+
21
+ const langs = Object . keys ( languages )
22
+
23
+ for ( let index = 0 ; index < langs . length ; index ++ ) {
24
+ const lang = langs [ index ]
25
+ const issueNumber = languages [ lang ]
26
+
27
+ const files = getAllTODOFiles ( lang )
28
+ const body = toMarkdown ( files )
29
+
30
+ await octokit . issues . update ( {
31
+ owner : "Microsoft" ,
32
+ repo : "TypeScript-Website" ,
33
+ issue_number : issueNumber ,
34
+ body,
35
+ } )
36
+ }
37
+ }
38
+
39
+ go ( )
You can’t perform that action at this time.
0 commit comments