GithubHelp home page GithubHelp logo

lin-jun-xiang / action-translate-readme Goto Github PK

View Code? Open in Web Editor NEW
35.0 4.0 6.0 65.93 MB

:books:Free GPT-3.5 Generate the README in Multiple Languages via CI/CD

Home Page: https://github.com/marketplace/actions/auto-translate-readme

License: MIT License

Shell 52.84% Python 47.16%
markdown readme chatgpt gpt4free ci-cd cicd gpt action translation github-actions

action-translate-readme's Introduction

action-translate-readme

Introduction

Note

The translator of version v1 is implemented through a third-party package on Linux; version v2 is implemented by calling the OpenAI API for free through g4f.

  • We all know that writing README documentation takes a lot of time, but now there is a solution that can save you half the time. This is our action-translate-readme.

  • Translate different language versions of README using gpt3.5.

  • Automatically commit (commit, push) the translated files through Github Actions (CI/CD).

  • For example: Write or modify the English version of README, and automatically generate versions of README in Traditional Chinese, Simplified Chinese, French, etc.

How to use?

Important

Since gpt3.5 is a generative AI model, there is a chance of problems with the translation results each time. It is recommended to use branch testing and try several times.

Warning

If you encounter the following error: Error: Input required and not supplied: token, please follow step two to ensure that the Token has been created or whether the Token has expired!

  1. Click on the โญ icon to add this project to your Github repository.

  2. Set up your Github Token:

    • Create a new Github Secret Token

      • Setting
      • Developer settings
      • Personal access tokens - Tokens (classic)
      • Generate new token
      • Choose token lifespan - it is recommended to use unlimited
      • Choose scopes: repo and workflow
      • Keep your secret token (do not lose it, you will need to paste it later)
    • Create a new repository secret

      • In your repository - settings
      • Securits and variables
      • Actions
      • New repository secret
      • Fill in the label with token and name it (eg: Action_Bot)
  3. Create an example of your action in the directory .github/workflows/your_action.yml. You can directly copy the following:

    # .github/workflows/translate.yml
    name: Translate Readme
    
    on:
        push:
            branches: ['**']
    
    jobs:
        translate:
            runs-on: ubuntu-latest
            steps:
                - name: Checkout
                  uses: actions/checkout@v3
                  with:
                    fetch-depth: 3
    
                - name: Auto Translate
                  uses: Lin-jun-xiang/action-translate-readme@v2 # Based on the tag
                  with:
                    token: ${{ secrets.Action_Bot }} # Based on step2 name
                    g4f_provider: g4f.Provider.DeepAi # You can change this provider
                    langs: "en,zh-TW,zh-CN,French,Arabic" # You can define any langs
    

    There are three parameters in .yml that need special attention:

    • token: The token created in the repos based on step 2.
    • g4f_provider: The provider of gpt, for more information, please refer to the link
    • langs: The language versions you want to generate, be sure to separate different languages with ,, for example:
      • "en": Translate only the English version
      • "en,zh-TW": Translate English and Traditional Chinese
      • "French,Arabic": Translate French and Arabic
  4. Now you can update README.md, and it will automatically generate a translated version!


Demo


Results of Test Document

  • View the test document
  • Use our tool to update the test document

Back to top

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.