Skip to content

Commit ae0dca2

Browse files
committed
Add translate action (temporary)
1 parent e7e70d4 commit ae0dca2

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/translate.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Translate
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
file:
6+
description: "File to translate"
7+
required: true
8+
9+
jobs:
10+
translate:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Clone CPython Repo
17+
run: git clone https://github.com/python/cpython venv/cpython
18+
19+
- name: Set Up Python 3.12
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.12-dev"
23+
24+
- name: Install dependencies
25+
run: pip install -r requirements.txt && sudo apt update && sudo apt install gettext -y
26+
27+
- name: Run translate.py
28+
run: python translate.py ${{ github.event.inputs.file }} -t google -s
29+
30+
- name: Commit changes
31+
run: |
32+
git config --local user.email "python.docs.tr@gmail.com"
33+
git config --local user.name "python-docs-turkish"
34+
git commit -m "Translate ${{ github.event.inputs.file }}"
35+
36+
- name: Create Pull Request
37+
uses: peter-evans/create-pull-request@v5.0.2
38+
with:
39+
token: ${{ secrets.BOT_PAT }}
40+
commit-message: Translate ${{ github.event.inputs.file }}
41+
author: python-docs-turkish <python.docs.tr@gmail.com>
42+
committer: python-docs-turkish <python.docs.tr@gmail.com>
43+
branch: translate-${{ github.event.inputs.file }}
44+
delete-branch: true
45+
title: Translate Translate ${{ github.event.inputs.file }}
46+
body: "Translated: ${{ github.event.inputs.file }}"
47+
labels: new-translation

0 commit comments

Comments
 (0)