Skip to content

Commit ec7469b

Browse files
authored
Merge pull request #1118 from Divyansh013/english-commit-fix
fetch english commit first
2 parents 05feac8 + 48755f2 commit ec7469b

File tree

1 file changed

+13
-12
lines changed
  • .github/actions/translation-tracker

1 file changed

+13
-12
lines changed

.github/actions/translation-tracker/index.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ class GitHubCommitTracker {
379379
**Branch**: \`${this.currentBranch}\`
380380
381381
### 📅 Timeline
382-
- **Latest English update**: ${englishCommit ? `${englishCommit.date.toLocaleDateString()} by ${englishCommit.author}` : 'Unknown (commit data unavailable)'}
382+
- **Latest English update**: ${englishCommit.date.toLocaleDateString()} by ${englishCommit.author}
383383
384384
`;
385385

@@ -421,7 +421,7 @@ class GitHubCommitTracker {
421421
- [ ] Ensure translation is accurate and culturally appropriate
422422
423423
### 📝 Summary of English File Changes
424-
**Last commit**: ${englishCommit ? `[${englishCommit.message}](${englishCommit.url})` : 'Unavailable'}
424+
**Last commit**: [${englishCommit.message}](${englishCommit.url})
425425
426426
${outdatedLanguages.length > 0 || missingLanguages.length > 0 ? `**Change Type**: English file was updated. ${outdatedLanguages.length > 0 ? `${outdatedLanguages.map(l => this.getLanguageDisplayName(l.language)).join(', ')} translation${outdatedLanguages.length > 1 ? 's' : ''} may be outdated.` : ''} ${missingLanguages.length > 0 ? `${missingLanguages.map(l => this.getLanguageDisplayName(l.language)).join(', ')} translation${missingLanguages.length > 1 ? 's are' : ' is'} missing.` : ''}` : ''}
427427
@@ -544,12 +544,22 @@ async function checkTranslationStatus(changedFiles, githubTracker = null, create
544544
const fileTranslationMap = translationStatus.fileTranslationMap;
545545

546546
for (const englishFile of changedFiles) {
547+
548+
let englishCommit = null;
549+
if (githubTracker) {
550+
englishCommit = await githubTracker.getLastCommit(englishFile);
551+
if (!englishCommit) {
552+
console.log(`⚠️ Skipping ${englishFile} - could not retrieve commit data`);
553+
continue;
554+
}
555+
}
556+
547557
const fileTranslations = {
548558
englishFile,
549559
outdatedLanguages: [],
550560
missingLanguages: [],
551561
upToDateLanguages: [],
552-
englishCommit: null
562+
englishCommit
553563
};
554564

555565
for (const language of SUPPORTED_LANGUAGES) {
@@ -570,17 +580,8 @@ async function checkTranslationStatus(changedFiles, githubTracker = null, create
570580

571581

572582
if (githubTracker) {
573-
// Get English commit only once per file
574-
if (!fileTranslations.englishCommit) {
575-
fileTranslations.englishCommit = await githubTracker.getLastCommit(englishFile);
576-
}
577-
const englishCommit = fileTranslations.englishCommit;
578583
const translationCommit = await githubTracker.getLastCommit(translationPath);
579584

580-
if (!englishCommit) {
581-
continue;
582-
}
583-
584585
if (!translationCommit) {
585586
const missingItem = {
586587
englishFile,

0 commit comments

Comments
 (0)