Github Action

LocadexをGithub Actionとして使用する方法

概要

LocadexはGithub Actionとして設定することができます。

これはプロジェクトの継続的なi18nに便利です。

このワークフローがトリガーされるたびに、Locadexはプロジェクトに加えた変更を自動的に国際化し、 変更内容を含むプルリクエストを作成します。

以下は、Locadexを使用するGithub Actionワークフローの例です。

.github/workflows/locadex.yml
name: Run Locadex

on:
  push:
    branches: [main]
  workflow_dispatch:

permissions:
  contents: write
  pull-requests: write

jobs:
  locadex:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Run Locadex
        uses: generaltranslation/locadex@v0
        with:
          api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          gt_api_key: ${{ secrets.GT_API_KEY }}
          gt_project_id: ${{ secrets.GT_PROJECT_ID }}

ワークフローをニーズに合わせて自由にカスタマイズしてください。Typescriptを使用している場合は、Locadexを実行する前にプロジェクトをビルドするようにアクションを設定してください。

Github Actionは、プロジェクトで既にnpx locadex startを実行しているか、gt-nextを使用するようにプロジェクトを手動で設定していることを前提としています。

引数

PropTypeDefault
format_cmd??
string
-
no_translate??
boolean
false
pr_body??
string
Multi-line default PR body
pr_title??
string
Locadex: Continuous i18n for ${{ github.ref_name }}
pr_branch??
string
locadex/${{ github.ref_name }}
version??
string
latest
app_directory??
string
-
github_token??
string
${{ github.token }}
extensions??
string
-
match_files??
string
-
debug??
boolean
false
verbose??
boolean
false
no_telemetry??
boolean
false
max_concurrent??
string
-
batch_size??
string
-
gt_project_id??
string
-
gt_api_key??
string
-
api_key?
string
-

このガイドはいかがですか?

このページについて