Skip to content

Commit 82bc917

Browse files
committed
Update to latest
1 parent 3e58e40 commit 82bc917

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ jobs:
7878

7979
3. **Set Up the Workflow**: Add the above GitHub Actions workflow to your source repository (e.g., `.github/workflows/sync-content.yml`). This is created automatically if you used the `translations-cookiecutter`.
8080

81+
**Important:** Any content that can be translated needs to live inside `translations-source-path`.
82+
8183
## 🔄 How It Works
8284

8385
1. **Checkout Source Repository**: The action checks out the specified `source-repo` and `source-ref`.

main.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ def sync_website_content(
153153
email : str
154154
Email of the bot account.
155155
"""
156-
end = "/" if translations_source_path.endswith("/") else ""
156+
src_end = "/" if source_path.endswith("/") else ""
157+
trans_end = "/" if translations_source_path.endswith("/") else ""
157158
base_path = Path(os.getcwd())
158159
base_source_path = base_path / source_repo.split("/")[-1]
159160
if source_path in ["/", ""]:
@@ -207,21 +208,15 @@ def sync_website_content(
207208

208209
run(cmds)
209210

210-
run(["git", "config", "user.name", f'"{name}"'], cwd=base_translations_path)
211-
run(["git", "config", "user.email", f'"{email}"'], cwd=base_translations_path)
212-
213-
run(["git", "config", "user.name", f'"{name}"'], cwd=base_source_path)
214-
run(["git", "config", "user.email", f'"{email}"'], cwd=base_source_path)
211+
for path in [base_source_path, base_translations_path]:
212+
run(["git", "config", "user.name", f'"{name}"'], cwd=path)
213+
run(["git", "config", "user.email", f'"{email}"'], cwd=path)
215214

216215
date_time = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
217216
branch_name = f"content-sync-{date_time}"
218217

219-
src = str(src_path) + end
220-
221-
if src_path.name == trans_path.name:
222-
dest = str(trans_path.parent)
223-
else:
224-
dest = str(trans_path)
218+
src = str(src_path) + src_end
219+
dest = str(trans_path) + trans_end
225220

226221
run(["git", "checkout", "-b", branch_name], cwd=base_translations_path)
227222
os.makedirs(dest, exist_ok=True)

0 commit comments

Comments
 (0)