Skip to content

Fix: Run PO to JSON validation on PRs and bulletproof git diffs#6116

Open
varruunnn wants to merge 1 commit intosugarlabs:masterfrom
varruunnn:workflowpo
Open

Fix: Run PO to JSON validation on PRs and bulletproof git diffs#6116
varruunnn wants to merge 1 commit intosugarlabs:masterfrom
varruunnn:workflowpo

Conversation

@varruunnn
Copy link
Contributor

@varruunnn varruunnn commented Mar 6, 2026

The Bug (Why we need this PR)
Right now, the translation check only runs after a Pull Request is merged.
If a contributor changes a .po file but forgets to convert it to a .json file, their PR will still get a green checkmark ✅. But as soon as a maintainer clicks "Merge", the check runs on the master branch, fails, and breaks the repository for everyone.
Refer Image from Issue #6115
image

CLOSES #6115
proof2

The Fix
This PR forces the translation check to run before the PR is merged.
To make that work without crashing the bot, I made three small changes to the script:

Added pull_request to the triggers: Now, if someone forgets to convert their translation files, the bot will block their PR with a red ❌ so maintainers don't accidentally merge broken files.
Fixed the file checker: The old script only knew how to check files for push events. I added an if/else statement so the script knows how to find changed files during a Pull Request.
Prevented random crashes: Sometimes GitHub Actions forgets to download the master branch before checking the files. I added one line (git fetch) to force it to download the branch so the script doesn't crash with a fatal: bad object error.

  • Bug Fix
  • Feature
  • CI / Workflow
  • Refactor

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

✅ All Jest tests passed! This PR is ready to merge.

@github-actions github-actions bot added the bug fix Fixes a bug or incorrect behavior label Mar 6, 2026
@Ashutoshx7
Copy link
Contributor

Ashutoshx7 commented Mar 6, 2026

This PR closes a CI logic gap where uncompiled translation files could be successfully merged because validation only ran on push. It makes the minimal necessary changes to run the Quality Gate natively on Pull Requests, while reinforcing the existing bash script to prevent Git crashes. CLOSES #6115 proof2

Changes made Added pull_request trigger so translation checks run before a PR is merged, preventing late CI failures on main. Updated the diff logic to use the correct SHAs depending on the event (before/sha for pushes and base/head for PRs). Fetched the base commit during PR runs to ensure git diff has the required history and avoids bad object errors in CI.

  • Bug Fix
  • Feature
  • CI / Workflow
  • Refactor

i feel this works fine if possible ( you just need to edit the template)) and save it ci workflow runs

@Ashutoshx7
Copy link
Contributor

Screen.Recording.2026-03-06.072037.mp4

it works fine

@varruunnn
Copy link
Contributor Author

varruunnn commented Mar 6, 2026

@Ashutoshx7 this pr solves different issue this is actually a kind of bug only but if you want me to add this under performance or feature tag i'll add it let me know

@Ashutoshx7
Copy link
Contributor

@Ashutoshx7 this pr solves different issue this is actually a kind of bug only but if you want me to add this under performance or feature tag i'll add it let me know

if possible can u make the pr description a bit more clear

@varruunnn
Copy link
Contributor Author

@Ashutoshx7 is it fine now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Fixes a bug or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] Fix logic gap: PO to JSON validation does not run on PRs

2 participants