fix(ci): make i18n translation job manual + provider-selectable#77
Open
pacphi wants to merge 1 commit into
Open
fix(ci): make i18n translation job manual + provider-selectable#77pacphi wants to merge 1 commit into
pacphi wants to merge 1 commit into
Conversation
The 'Test Translation API Integration' job invoked 'ampel-i18n translate' without the required --lang argument, so it exited with code 2 on every push to main. The job was also structurally dead: the translate step had no id, so the create-pull-request gate on steps.translate.outputs.changed never fired, and --dry-run never wrote files to PR. Rework it into a manually-triggered, provider-selectable translation run: - switch the trigger to workflow_dispatch with a 'provider' choice input (deepl | google | openai | systran); the job no longer runs on push - inject ONLY the selected provider's secret into its matching *_API_KEY env var, so the fallback router pins translation to that provider - fail fast with a clear message if the chosen provider's secret is unset - build the binary once, then translate every locale directory (English source excluded -> 26 targets) via 'translate --lang <lang>' - record changed locales from git porcelain output as step outputs (changed, languages) and gate the consolidated PR on them - make the PR body report which provider produced the updates All run-step inputs are trusted (locale names from the filesystem, secrets via env), so there is no workflow-injection surface.
Owner
Author
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
📊 Coverage Report
Coverage Thresholds
Coverage reports generated by CI workflow |
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.
Problem
The Test Translation API Integration job (
i18n-validation.yml) failed on every push tomain— run 28552356309. It invokedampel-i18n translatewithout the required--langargument, exiting with code 2 (the following required arguments were not provided: --lang).The job was also structurally dead beyond that error:
id, so thecreate-pull-requestgate onsteps.translate.outputs.changedcould never fire;--dry-runnever wrote files, so there was nothing to PR anyway;translatehandles one locale per call, but there are 26 target locales.Change
Reworked it into a manually-triggered, provider-selectable translation run:
workflow_dispatchwith aproviderchoice input (deepl|google|openai|systran, defaultdeepl). The job no longer runs on push, so it can't red-X merges tomain.*_API_KEYenv var. The fallback router initializes whichever key is present, so exposing exactly one pins translation to the chosen provider — no--providerflag spelling to get wrong.translate --lang <lang>, records changed locales fromgit status --porcelainas step outputs (changed,languages), and gates one consolidated PR on them. PR body reports which provider produced the updates.Notes / follow-ups
DEEPL_API_KEY/GOOGLE_API_KEY/OPENAI_API_KEY/SYSTRAN_API_KEY.validate-*jobs (noif:gate) will also run on manual dispatch as harmless pre-flight validation; PR-only jobs stay skipped.How to run
Actions tab → I18n Validation → Run workflow → pick a provider. Or:
All run-step inputs are trusted (locale names from the filesystem, secrets via
env:) — no workflow-injection surface.