メニュー画面 #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Localization | |
on: | |
pull_request: | |
paths: | |
- 'Assets/uDesktopMascot/LocalizationTable/LocalizationTable.csv' | |
jobs: | |
translate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: リポジトリをチェックアウト | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 # フルgit履歴を取得 | |
- name: Pythonをセットアップ | |
uses: actions/[email protected] | |
with: | |
python-version: '3.11' | |
- name: 依存関係のインストール | |
run: | | |
pip install openai pandas gitpython | |
- name: 翻訳スクリプトを実行 | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: python .github/scripts/translate_localization.py | |
- name: 変更をコミット | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
# 変更をステージしてコミット | |
git add Assets/uDesktopMascot/LocalizationTable/LocalizationTable.csv | |
if git commit -m "自動翻訳を追加(GitHub Actionsによる)"; then | |
echo "Changes committed successfully." | |
# リモートの最新の変更を取り込み、リベース | |
if git pull --rebase origin ${{ github.head_ref }}; then | |
echo "Successfully rebased." | |
else | |
echo "Rebase failed. Please review the errors." | |
exit 1 # エラーが発生した場合、処理を中止 | |
fi | |
# スタッシュが必要かを確認 | |
if git stash list | grep -q "stash@{0}"; then | |
# スタッシュが存在する場合はポップする | |
git stash pop | |
fi | |
# 最後にプッシュ | |
git push origin HEAD:${{ github.head_ref }} | |
else | |
echo "No changes to commit" | |
- name: PRにコメントを追加 | |
if: success() || failure() | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: ${{ github.event.pull_request.number }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "自動翻訳が完了し、ローカライズCSVに反映されました。" | |
}) |