microsoft/AI-For-Beginners

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
72507ad5e03976fe57b26ef2fb8526cef27734b0

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

109lines ยท modepreview

name: Co-op Translator

on:
  push:
    branches:
      - main

jobs:
  co-op-translator:
    runs-on: ubuntu-latest

    permissions:
      contents: write
      pull-requests: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: Install Co-op Translator
        run: |
          python -m pip install --upgrade pip
          pip install co-op-translator

      - name: Run Co-op Translator
        env:
          PYTHONIOENCODING: utf-8
          # Azure AI Service Credentials
          AZURE_AI_SERVICE_API_KEY: ${{ secrets.AZURE_AI_SERVICE_API_KEY }}
          AZURE_AI_SERVICE_ENDPOINT: ${{ secrets.AZURE_AI_SERVICE_ENDPOINT }}

          # Azure OpenAI Credentials
          AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
          AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
          AZURE_OPENAI_MODEL_NAME: ${{ secrets.AZURE_OPENAI_MODEL_NAME }}
          AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_CHAT_DEPLOYMENT_NAME }}
          AZURE_OPENAI_API_VERSION: ${{ secrets.AZURE_OPENAI_API_VERSION }}

          # OpenAI Credentials
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          OPENAI_ORG_ID: ${{ secrets.OPENAI_ORG_ID }}
          OPENAI_CHAT_MODEL_ID: ${{ secrets.OPENAI_CHAT_MODEL_ID }}
          OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
        run: |
          # =====================================================================
          # IMPORTANT: Set your target languages here (REQUIRED CONFIGURATION)
          # =====================================================================
          # Example: Translate to Spanish, French, German. Add -y to auto-confirm.
          # translate -l "all" -y  # <--- MODIFY THIS LINE with your desired languages
          # translate -l "ar bn bg br cs da de el es fa fi" -nb 
          # translate -l "fr he hi hr hu id it ja" -nb
          # translate -l "ko lt mo ms mr my ne nl no pa pl" -nb
          # translate -l "pt ro ru sk sl sr sv sw" -nb  
          # translate -l  "th tl tr tw uk ur vi zh hk" -nb
          translate -l "ar ur tl mr ne pa bn ru mo" -y
          # translate -l "mr ne pa" -y
          # translate -l "bn ru mo" -y
          # translate -l "br it tr el th sv da no" -y
          # translate -l "el th" -y
          # translate -l "sv da no" -y
          # translate -l "fi nl he vi id ms sw hu cs" -y
          # translate -l "vi id ms" -y
          # translate -l "sw hu cs" -y
          # translate -l "sk ro bg sr" -y
          # translate -l "sr hr sl" -y
          # translate -l "ja uk my" -y
          # translate -l "de es fa" -y
          # translate -l "fr hi ko lt" -y
          # translate -l "pl pt zh" -y
          # translate -l "hk tw" -y

      - name: Authenticate GitHub App
        id: generate_token
        uses: tibdex/github-app-token@v1
        with:
          app_id: ${{ secrets.GH_APP_ID }}
          private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}

      - name: Create Pull Request with translations
        uses: peter-evans/create-pull-request@v5
        with:
          token: ${{ steps.generate_token.outputs.token }}
          commit-message: "๐ŸŒ Update translations via Co-op Translator"
          title: "๐ŸŒ Update translations via Co-op Translator"
          body: |
            This PR updates translations for recent changes merged into the `main` branch.

            ### ๐Ÿ“‹ Summary of Changes
            - Translated markdown content has been added under the `translations/` directory
            - Translated images (if applicable) have been generated in the `translated_images/` directory

            ๐Ÿ” Co-op Translator ensures that changes in links, structure, or inline elements in the original content are automatically reflected in all translated files.

            ---
            ๐ŸŒ This pull request was automatically generated by [Co-op Translator](https://github.com/Azure/co-op-translator), powered by Azure AI.

          branch: update-translations
          base: main
          delete-branch: true
          add-paths: |
            translations/
            translated_images/