@@ -40,6 +40,25 @@ export const decompressFile = async (filePath: string, targetDir: string) => {
40
40
console . log ( "✅ Decompression complete." )
41
41
}
42
42
43
+ const getQAMessage = ( locale : string ) => {
44
+ const summaryJson : QASummary = JSON . parse ( readFileSync ( SUMMARY_PATH , "utf-8" ) )
45
+ const qaResults = summaryJson [ locale ]
46
+ ? summaryJson [ locale ] . map ( ( s ) => "- " + s ) . join ( "\n" )
47
+ : null
48
+
49
+ if ( ! qaResults ) return "No QA issues found"
50
+ return `
51
+ \`\`\`shell
52
+ yarn markdown-checker
53
+ \`\`\`l
54
+
55
+ <details><summary>Unfold for ${ summaryJson [ locale ] . length } result(s)</summary>
56
+
57
+ ${ qaResults }
58
+ </details>
59
+ `
60
+ }
61
+
43
62
export const processLocale = ( locale : string , buckets : number [ ] ) => {
44
63
const gitStatus = execSync ( `git status -s | grep -E "/${ locale } /" | wc -l` , {
45
64
encoding : "utf-8" ,
@@ -61,11 +80,6 @@ export const processLocale = (locale: string, buckets: number[]) => {
61
80
execSync ( `git commit -m "${ message } "` )
62
81
execSync ( `git push origin ${ branchName } ` )
63
82
64
- const summaryJson : QASummary = JSON . parse ( readFileSync ( SUMMARY_PATH , "utf-8" ) )
65
- const qaResults = summaryJson [ locale ]
66
- ? summaryJson [ locale ] . map ( ( s ) => "- " + s ) . join ( "\n" )
67
- : null
68
-
69
83
const prBody = `## Description
70
84
This PR was automatically created to import Crowdin translations.
71
85
This workflows runs on the first of every month at 16:20 (UTC).
@@ -78,20 +92,8 @@ export const processLocale = (locale: string, buckets: number[]) => {
78
92
) }
79
93
80
94
## Markdown QA checker alerts
81
- ${
82
- qaResults
83
- ? `
84
- \`\`\`shell
85
- yarn markdown-checker
86
- \`\`\`l
87
-
88
- <details><summary>Unfold for ${ summaryJson [ locale ] . length } result(s)</summary>
89
-
90
- ${ qaResults }
91
- </details>
95
+ ${ getQAMessage ( locale ) }
92
96
`
93
- : "No QA issues found"
94
- } `
95
97
96
98
const bodyWritePath = path . resolve ( process . cwd ( ) , "body.txt" )
97
99
writeFileSync ( bodyWritePath , prBody )
0 commit comments