Ensure Lokalise download runs as the same user as GitHub Actions (#149026)

This commit is contained in:
Franck Nijhof 2025-07-18 19:56:19 +02:00 committed by GitHub
parent 916b4368dd
commit 3877a6211a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,7 @@
from __future__ import annotations from __future__ import annotations
import json import json
import os
from pathlib import Path from pathlib import Path
import re import re
import subprocess import subprocess
@ -20,13 +21,15 @@ DOWNLOAD_DIR = Path("build/translations-download").absolute()
def run_download_docker(): def run_download_docker():
"""Run the Docker image to download the translations.""" """Run the Docker image to download the translations."""
print("Running Docker to download latest translations.") print("Running Docker to download latest translations.")
run = subprocess.run( result = subprocess.run(
[ [
"docker", "docker",
"run", "run",
"-v", "-v",
f"{DOWNLOAD_DIR}:/opt/dest/locale", f"{DOWNLOAD_DIR}:/opt/dest/locale",
"--rm", "--rm",
"--user",
f"{os.getuid()}:{os.getgid()}",
f"lokalise/lokalise-cli-2:{CLI_2_DOCKER_IMAGE}", f"lokalise/lokalise-cli-2:{CLI_2_DOCKER_IMAGE}",
# Lokalise command # Lokalise command
"lokalise2", "lokalise2",
@ -52,7 +55,7 @@ def run_download_docker():
) )
print() print()
if run.returncode != 0: if result.returncode != 0:
raise ExitApp("Failed to download translations") raise ExitApp("Failed to download translations")