Coder Social home page Coder Social logo

crowdin-action's Introduction

Crowdin Github Actions

This repository holds all of our tooling for the Crowdin integration. This allows us to manage multiple repositories and projects without having to duplicate tooling, and maintain a single source of truth for the configuration objects.

Required Environment Variables

The following environment variables are required to be set in order to run the actions, regardless of which plugin is chosen.

CROWDIN_PERSONAL_TOKEN, CROWDIN_API_URL, PROJECT_ID, and PLUGIN. Note that PLUGIN should match one of the options below.

Plugins

The action is designed to be modular, with multiple plugins to choose from for each step. The plugins and environment variables are as follows:

Plugin Description Environment Variables
check-paths Prints the current process directory and contents. See File Structure none
commit-changes This plugin creates a commit with all changed files, except for the crowdin-config.yml. GH_USERNAME, GH_EMAIL, GH_BRANCH, GH_MESSAGE
convert-chinese This plugin copies the Simplified Chinese translations to Traditional Chinese. The file path should be /some/folders/chinese, and the result will be /some/folders/chinese-traditional. Note that FILE_PATHS should be a stringified array, as GitHub yaml doesn't accept array values: '["curriculum/challenges/chinese", "curriculum/dictionaries/chinese"]'. Set USE_LANG_CODES to true to do zh -> zh-TW instead. FILE_PATHS, USE_LANG_CODE
generate-config This looks at the PROJECT_NAME value and finds the matching configuration file in /src/configs, then copies it to the current directory as crowdin-config.yml. PROJECT_NAME
hide-curriculum-strings This plugin runs through all of the strings in the specified project and hides them if they meet specific conditions. none
hide-renpy-strings This plugin runs through all of the strings in the specified project and hides them if they meet specific conditions. none
hide-string Looks for a specific string in a specific file and marks it as hidden. FILE_NAME, STRING_CONTENT
lowercase-directories This plugin will walk through the FILE_PATH directory and make sure all sub-directories are set to lowercase FILE_PATH
pull-request Creates a pull request from the specified branch and targets the specified base, or main by default. GH_TOKEN, BRANCH, REPOSITORY, BASE, TITLE, BODY
remove-deleted-files This will recursively walk through the FILE_PATHS directories and remove any files from Crowdin that are no longer present in the repo. Note that FILE_PATHS should be a stringified array, as GitHub yaml doesn't accept array values: '["curriculum/challenges/english", "curriculum/dictionaries/english"]' FILE_PATHS
unhide-string Looks for a specific string in a specific file and marks it as visible. FILE_NAME, STRING_CONTENT

Refer to action.yml for more information on the environment variables.

Example Usage

Here is an example step in an action file which uses this package:

- name: Generate Crowdin Config
  uses: nhcarrigan/crowdin-action@main
  env:
    CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
    CROWDIN_API_URL: "https://nhcarrigan.crowdin.com/api/v2/"
    CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_CURRICULUM }}
    PLUGIN: "generate-config"
    PROJECT_NAME: "client"

Making Changes

Any PR that is submitted to make changes to the action code (within src) must also include the distribution build. You can generate the distribution build by running npm run package, which will bundle all of the code into a single file and save it as /dist/index.js. The actions runner relies on this file to avoid having to install dependencies.

crowdin-action's People

Contributors

a2937 avatar ojeytonwilliams avatar shaunshamilton avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

crowdin-action's Issues

The validateEnvironment function requires more than is needed.

Describe the bug

Trying to run the pull-request plugin, and only gave it the env variables specified: GH_TOKEN, BRANCH, REPOSITORY, BASE, TITLE, BODY - it gave me an error: "Missing Crowdin credentials." It looks like the validateEnvironment function wants CROWDIN_PERSONAL_TOKEN and CROWDIN_API_URL - but the plugin doesn't use those as far as I can tell. Seems like the validation should only require the things necessary for the plugin. I may be missing something, but I think that's accurate.

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.