Giter Site home page Giter Site logo

vbeytok / github-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crowdin/github-action

0.0 0.0 0.0 161 KB

A GitHub action to manage and synchronize localization resources with your Crowdin project

Home Page: https://crowdin.com

License: MIT License

Shell 98.67% Dockerfile 1.33%

github-action's Introduction

GitHub Crowdin Action Tweet GitHub Repo stars

A GitHub action to manage and synchronize localization resources with your Crowdin project

What does this action do?

  • Uploads sources to Crowdin.
  • Uploads translations to Crowdin.
  • Downloads translations from Crowdin.
  • Creates a PR with the translations.

Usage

Set up a workflow in .github/workflows/crowdin.yml (or add a job to your existing workflows).

Read the Configuring a workflow article for more details on how to create and set up custom workflows.

name: Crowdin Action

on:
  push:
    branches: [ main ]

jobs:
  synchronize-with-crowdin:
    runs-on: ubuntu-latest

    steps:

    - name: Checkout
      uses: actions/checkout@v3

    - name: crowdin action
      uses: crowdin/github-action@v1
      with:
        upload_translations: true
        download_translations: true
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
        CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

📁 For more examples see the EXAMPLES.md

📋 To explore the common questions about Crowdin GitHub Action usage visit the Wiki.

Supported options

The default action is to upload sources. Though, you can set different actions through the “with” options. If you don't want to upload your sources to Crowdin, just set the upload_sources option to false.

By default, sources and translations are being uploaded to the root of your Crowdin project. Still, if you use branches, you can set the preferred source branch.

You can also specify what GitHub branch you’d like to download your translations to (default translation branch is l10n_crowdin_action).

In case you don’t want to download translations from Crowdin (download_translations: false), localization_branch_name and create_pull_request options aren't required either.

- name: crowdin action
  with:
    # Upload sources option
    upload_sources: true
    # This can be used to pass down any supported argument of the `upload sources` cli command, e.g.
    upload_sources_args: '--no-auto-update label=web'

    # Upload translations options
    upload_translations: true
    upload_language: 'uk'
    auto_approve_imported: true
    import_eq_suggestions: true
    # This can be used to pass down any supported argument of the `upload translations` cli command, e.g.
    upload_translations_args: '--auto-approve-imported --translate-hidden'

    # Download translations options
    download_translations: true
    download_language: 'uk'
    skip_untranslated_strings: true
    skip_untranslated_files: true
    export_only_approved: true
    push_translations: true
    commit_message: 'New Crowdin translations by Github Action'
    # this can be used to pass down any supported argument of the `download translations` cli command, e.g.
    download_translations_args: '--all --skip-untranslated-strings'

    # This is the name of the git branch that Crowdin will create when opening a pull request.
    # This branch does NOT need to be manually created. It will be created automatically by the action.
    localization_branch_name: l10n_crowdin_action
    create_pull_request: true
    pull_request_title: 'New Crowdin translations'
    pull_request_body: 'New Crowdin pull request with translations'
    pull_request_labels: 'enhancement, good first issue'
    pull_request_assignees: 'crowdin-bot'
    pull_request_reviewers: 'crowdin-reviewer'
    # This is the name of the git branch to with pull request will be created.
    # If not specified default repository branch will be used.
    pull_request_base_branch_name: not_default_branch

    # Branch options

    add_crowdin_branch: branch_name
    # Title as it appears to translators
    new_branch_title: 'development / main'
    # Defines branch name and path in resulting translations bundle
    new_branch_export_pattern: '/translations/%two_letters_code%/%original_file_name%'
    # [LOW, NORMAL, HIGH]
    new_branch_priority: 'HIGH'

    delete_crowdin_branch: branch_name

    # Global options

    # This is the name of the top-level directory that Crowdin will use for files.
    # Note that this is not a "branch" in the git sense, but more like a top-level directory in your Crowdin project.
    # This branch does NOT need to be manually created. It will be created automatically by the action.
    crowdin_branch_name: l10n_branch
    identity: 'path/to/your/credentials/file'
    config: 'path/to/your/crowdin.yml'
    dryrun_action: true

    # GitHub (Enterprise) configuration
    github_base_url: github.com
    github_api_base_url: api.[github_base_url]
    github_user_name: Crowdin Bot
    github_user_email: [email protected]
    
    # For signed commits, add your ASCII-armored key and export "gpg --armor --export-secret-key GPG_KEY_ID"
    # Ensure that all emails are the same: for account profile that holds private key, the one specified during key generation, and for commit author (github_user_email parameter)
    gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
    gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}

    # Config options

    # The numeric project ID. Visit the Tools > API section in your Crowdin project
    project_id: ${{ secrets.CROWDIN_PROJECT_ID }}

    # A Personal Access Token (see https://crowdin.com/settings#api-key)
    token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
    source: 'path/to/your/file'
    translation: 'file/export/pattern'
    base_url: 'https://crowdin.com'
    base_path: 'project-base-path'

Note: For Crowdin Enterprise base_url is required and should be passed in the following way: base_url: 'https://{organization-name}.crowdin.com'

For more detailed descriptions of these options, see action.yml.

Crowdin configuration file

If your workflow file specifies the config property, you'll need to add the following to your Crowdin configuration file (e.g. crowdin.yml):

project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN

When the workflow runs, the real values of your token and project ID will be injected into the config using the secrets in the environment.

Contributing

If you want to contribute please read the Contributing guidelines.

Seeking Assistance

If you find any problems or would like to suggest a feature, please feel free to file an issue on Github at Issues Page.

Need help working with Crowdin GitHub Action or have any questions? Contact Customer Success Service.

License

The Crowdin GitHub Action is licensed under the MIT License.
See the LICENSE file distributed with this work for additional
information regarding copyright ownership.

Except as contained in the LICENSE file, the name(s) of the above copyright
holders shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written authorization.

github-action's People

Contributors

vbeytok avatar andrii-bodnar avatar zeke avatar conconnl avatar mrchrisw avatar bartlebyy avatar blairbodnar avatar justarchi avatar randymarsh77 avatar dzonatan avatar szpadel avatar rohalskyy avatar ultr4nerd avatar mjacobus avatar johnan avatar ffflorian avatar dy-dx avatar

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.