microsoft/AI-For-Beginners

Public

mirrored fromhttps://github.com/microsoft/AI-For-BeginnersAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0a48d86a93cf2917e964616b2d93d015138533d9

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/co-op-translator.yml

102lines ยท modecode

1name: Co-op Translator
2
3on:
4 push:
5 branches:
6 - main
7
8jobs:
9 co-op-translator:
10 runs-on: ubuntu-latest
11
12 permissions:
13 contents: write
14 pull-requests: write
15
16 steps:
17 - name: Checkout repository
18 uses: actions/checkout@v4
19 with:
20 fetch-depth: 0
21
22 - name: Set up Python
23 uses: actions/setup-python@v4
24 with:
25 python-version: '3.10'
26
27 - name: Install Co-op Translator
28 run: |
29 python -m pip install --upgrade pip
30 pip install co-op-translator
31
32 - name: Run Co-op Translator
33 env:
34 PYTHONIOENCODING: utf-8
35 # Azure AI Service Credentials
36 AZURE_AI_SERVICE_API_KEY: ${{ secrets.AZURE_AI_SERVICE_API_KEY }}
37 AZURE_AI_SERVICE_ENDPOINT: ${{ secrets.AZURE_AI_SERVICE_ENDPOINT }}
38
39 # Azure OpenAI Credentials
40 AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
41 AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
42 AZURE_OPENAI_MODEL_NAME: ${{ secrets.AZURE_OPENAI_MODEL_NAME }}
43 AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_CHAT_DEPLOYMENT_NAME }}
44 AZURE_OPENAI_API_VERSION: ${{ secrets.AZURE_OPENAI_API_VERSION }}
45
46 # OpenAI Credentials
47 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
48 OPENAI_ORG_ID: ${{ secrets.OPENAI_ORG_ID }}
49 OPENAI_CHAT_MODEL_ID: ${{ secrets.OPENAI_CHAT_MODEL_ID }}
50 OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
51 run: |
52 # =====================================================================
53 # IMPORTANT: Set your target languages here (REQUIRED CONFIGURATION)
54 # =====================================================================
55 # Example: Translate to Spanish, French, German. Add -y to auto-confirm.
56 translate -l "all" -y # <--- MODIFY THIS LINE with your desired languages
57 # translate -l "ar ur tl mr ne pa bn ru mo" -y
58 # translate -l "mr ne pa" -y
59 # translate -l "bn ru mo" -y
60 # translate -l "br it tr el th sv da no" -y
61 # translate -l "el th" -y
62 # translate -l "sv da no" -y
63 # translate -l "fi nl he vi id ms sw hu cs" -y
64 # translate -l "vi id ms" -y
65 # translate -l "sw hu cs" -y
66 # translate -l "sk ro bg sr" -y
67 # translate -l "sr hr sl" -y
68 # translate -l "ja uk my" -y
69 translate -l "de es fa fr hi ko lt" -y
70 # translate -ln"pl pt zh hk tw" -y
71
72 - name: Authenticate GitHub App
73 id: generate_token
74 uses: tibdex/github-app-token@v1
75 with:
76 app_id: ${{ secrets.GH_APP_ID }}
77 private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}
78
79 - name: Create Pull Request with translations
80 uses: peter-evans/create-pull-request@v5
81 with:
82 token: ${{ steps.generate_token.outputs.token }}
83 commit-message: "๐ŸŒ Update translations via Co-op Translator"
84 title: "๐ŸŒ Update translations via Co-op Translator"
85 body: |
86 This PR updates translations for recent changes merged into the `main` branch.
87
88 ### ๐Ÿ“‹ Summary of Changes
89 - Translated markdown content has been added under the `translations/` directory
90 - Translated images (if applicable) have been generated in the `translated_images/` directory
91
92 ๐Ÿ” Co-op Translator ensures that changes in links, structure, or inline elements in the original content are automatically reflected in all translated files.
93
94 ---
95 ๐ŸŒ This pull request was automatically generated by [Co-op Translator](https://github.com/Azure/co-op-translator), powered by Azure AI.
96
97 branch: update-translations
98 base: main
99 delete-branch: true
100 add-paths: |
101 translations/
102 translated_images/
103