| 215 | }); |
| 216 | |
| 217 | async function loadUpdatedLocales() { |
| 218 | const diffUrl = process.env.DIFF_URL; |
| 219 | if (!diffUrl) return; |
| 220 | const res = await fetch(diffUrl); |
| 221 | const result = await res.text(); |
| 222 | // Example: |
| 223 | // diff --git a/_locales/ko/messages.yml b/_locales/ko/messages.yml |
| 224 | const langs = result.split('\n') |
| 225 | .map(line => { |
| 226 | const matches = line.match(/^diff --git a\/_locales\/([^/]+)\/messages.yml b\/_locales\/([^/]+)\/messages.yml$/); |
| 227 | const [, code1, code2] = matches || []; |
| 228 | return code1 === code2 && code1; |
| 229 | }) |
| 230 | .filter(Boolean); |
| 231 | return langs; |
| 232 | } |
| 233 | |
| 234 | async function pushTranslations(lang) { |
| 235 | const { local, remote } = await loadData(lang); |