Translation tracker: auto close issue on PR merged and closed - #1582
Draft
aashishpanthi wants to merge 20 commits into
Draft
Translation tracker: auto close issue on PR merged and closed#1582aashishpanthi wants to merge 20 commits into
aashishpanthi wants to merge 20 commits into
Conversation
…README documentation
…generation limits per language; remove test files.
As adviced by mentor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The translation tracker opens a GitHub issue for every outdated or missing translation. Until now, those issues stayed open after the translation actually landed, so maintainers had to close them by hand and there was backlog.
This adds a
translation-auto-close.ymlworkflow that runs when a PR touching translated content is merged. It works out which tracker issues the PR resolves, marks off the languages that were translated, and closes each issue once nothing is left to translate.Addresses #1404.
How an issue is found
Relying on
Resolves #123did not worked well with real contributors: most translation PRs either use no linking keyword or mention the issue somewhere other than the body. So any#123is treated as a candidate, and it is looked for in:#123" during review)https://github.com/<owner>/<repo>/issues/123linksHow false positives are avoided
Matching every
#123is deliberately greedy, so candidates are filtered:owner/repo#123cross-repo references and#123abcare not matched; numbers are capped at six digitsneeds translationlabelHow an issue is updated
Which languages a PR translated is derived from its changed file paths, for example
src/content/examples/es/...means Spanish. For each such language, the action removes thelang-<code>label and strikes that language's line in the issue body. The issue is closed only when nolang-*labels are left.One tracker issue often covers several languages for the same English file, which creates a wrinkle: GitHub closes an issue natively the instant a PR saying
Fixes #123is merged, even when only one of four languages was done. The action detects this and reopens the issue, leaving a comment naming the languages still working.Testing
npm run test:auto-closeruns the flow against a mocked GitHub API and covers: keyword-free references, the reopen path, comment-sourced references, bot filtering, cross-references, noise rejection, referenced pull requests, and PRs with no translation files.