Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/actions/translation-tracker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class GitHubCommitTracker {
let isTruncated = false;
if (patch) {
const lines = patch.split('\n');
const maxLines = 80;
const maxLines = 50;
if (lines.length > maxLines) {
patchSnippet = lines.slice(0, maxLines).join('\n');
isTruncated = true;
Expand Down Expand Up @@ -407,6 +407,24 @@ class GitHubCommitTracker {
});
}

// English diff. It shows the actual content changes in the English file.
if (englishDiff && (englishDiff.compareUrl || englishDiff.patchSnippet)) {
body += `### 🧩 Recent English Diff\n\n`;
if (englishDiff.compareUrl) {
body += `- [🔍 View full compare](${englishDiff.compareUrl})\n\n`;
}
if (englishDiff.patchSnippet) {
body += `<details>\n<summary>Show patch snippet</summary>\n\n`;
body += `\`\`\`diff\n${englishDiff.patchSnippet}\n\`\`\`\n\n`;
if (englishDiff.isTruncated) {
body += `_(Patch snippet truncated. Use the compare link above for the full diff.)_\n\n`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by compare link are we referring to View full compare used above?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by compare link are we referring to View full compare used above?

yes we are

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then what if englishDiff.compareUrl is false but englishDiff.patchSnippet is true? your driving if condition will satisfy but there will be no compare link right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then what if englishDiff.compareUrl is false but englishDiff.patchSnippet is true? your driving if condition will satisfy but there will be no compare link right?

I was going to say yes, but I looked at the code, and I don't see a scenario where the compareUrl is false. Inside getRecentDiffForFile() there is no instance where the function will return the null compareUrl.

Please let me know if I missed anything.

}
body += `</details>\n\n`;
} else {
body += `_(Couldn't generate preview of the differences for this change. Use the compare link above to see the full diff.)_\n\n`;
}
}

body += `### 🔗 Quick Links
- [📄 Current English file](https://github.com/${this.owner}/${this.repo}/blob/${this.currentBranch}/${englishFile})

Expand Down