# gt: General Translation CLI tool: GitHub Actions を使う
URL: https://generaltranslation.com/ja/docs/cli/guides/continuous-translation/using-github-actions.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: General Translation の GitHub Action で翻訳のプルリクエストを自動化する方法。

生成した翻訳をバージョン管理下に置き、`main` へプッシュするたびにプルリクエストを自動作成したい場合は、[`generaltranslation/translate`](https://github.com/generaltranslation/translate) GitHub Action を使用します。

## セットアップ [#setup]

1. `gt.config.json` をコミットし、GitHub の **Settings &gt; Secrets and variables &gt; Actions** で `GT_API_KEY` と `GT_PROJECT_ID` を追加します ([共通要件](/docs/cli/guides/continuous-translation#credentials)を参照) 。
2. `.github/workflows/translate.yml` にワークフローファイルを追加します。

```yaml title=".github/workflows/translate.yml"
name: GT Translate

on:
  push:
    branches: [main]

jobs:
  translate:
    runs-on: ubuntu-latest
    if: ${{ github.event.head_commit.author.name != 'github-actions[bot]' && !contains(github.event.head_commit.message, 'gt-translate/') }}
    permissions:
      contents: write
      pull-requests: write
    steps:
      - uses: actions/checkout@v4

      - uses: generaltranslation/translate@v0
        with:
          gt_api_key: ${{ secrets.GT_API_KEY }}
          gt_project_id: ${{ secrets.GT_PROJECT_ID }}
          config: 'gt.config.json'
          pr_branch: 'gt-translate/${{ github.ref_name }}'
```

このアクションは [`gt translate`](/docs/cli/reference/commands/translate) を実行して更新されたファイルをコミットし、変更がある場合はプルリクエストを作成します。

## 共通の入力 [#inputs]

* `app_directory`: モノレポ内のアプリフォルダへの相対パス。
* `pr_auto_merge`: `'true'` に設定すると、リポジトリのルールで許可されている場合にプルリクエストを自動でスカッシュマージします。
* `pr_title` と `pr_body`: プルリクエストのタイトルと説明をカスタマイズします。
* `dry_run`: `'true'` に設定すると、API を呼び出さずに検証のみを行います。
* `version`: CLI のバージョンを固定します (デフォルトは `latest`) 。

## Next steps

- /docs/cli/guides/continuous-translation/running-in-cd
- /docs/cli/guides/continuous-translation/staging-in-ci
- /docs/cli/guides/continuous-translation/splitting-ci-stages
- /docs/cli/guides/generating-translations

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
