Skip to content

fix: fail fast on DeepL 403 and prevent silent untranslated PR creation - #1567

Draft
sonvnn with Copilot wants to merge 1 commit into
masterfrom
copilot/auto-translate-error-fix
Draft

fix: fail fast on DeepL 403 and prevent silent untranslated PR creation#1567
sonvnn with Copilot wants to merge 1 commit into
masterfrom
copilot/auto-translate-error-fix

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Auto-translate silently produces PRs with English "translations" when the DeepL API key is invalid — every batch returns 403, the broad except Exception falls back to source text, and the workflow exits 0.

Changes

  • Fail fast on 403/456: catch urllib.error.HTTPError explicitly; raise RuntimeError immediately on auth/quota errors instead of falling back to source text and burning through all remaining batches
  • Surface DeepL's error body: reads the response payload (e.g. "Wrong endpoint. Please use the DeepL API Free endpoint…") and includes it in the error message
  • Propagate failure: sync_locale returns {"error": ...} on abort (no file written); main exits non-zero when any locale fails → CI step fails → Check for modified files and PR-creation steps are skipped
  • Strip API key: DEEPL_API_KEY.strip() guards against trailing whitespace/newlines in the secret value
  • Summary table: shows ERROR row for failed locales instead of misleading coverage stats
── de-DE ──
  [de-DE] FATAL – DeepL auth/quota error (aborting remaining batches):
          HTTP Error 403: Forbidden – Wrong endpoint. Please use the DeepL API Free endpoint…
══════════════════════════════════════════════════════════════
de-DE          ERROR  (translation aborted – see above)

Repo owner action required: verify DEEPL_API_KEY in Settings → Secrets → Actions. Free-tier keys end with :fx (script auto-routes to api-free.deepl.com).

Copilot AI changed the title fix: abort on DeepL 403 auth errors and exit non-zero on translation failures fix: fail fast on DeepL 403 and prevent silent untranslated PR creation Jul 30, 2026
Copilot AI requested a review from sonvnn July 30, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants