Skip to content

Commit

Permalink
feat: add translate script
Browse files Browse the repository at this point in the history
  • Loading branch information
kannoixia committed Jul 2, 2024
1 parent f060db4 commit b870d2d
Show file tree
Hide file tree
Showing 9 changed files with 1,297 additions and 24 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/auto_translate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,20 @@ jobs:
# ファイル取得、翻訳、ファイル上書き処理
- name: Check and get changed files
run: bash auto_translate/script/check_change.sh "${{ secrets.GITHUB_TOKEN }}"
- name: Translation with chatGPT
run: bash auto_translate/script/translate.sh

# Nodeの環境構築
- name: Use Node.js 20.9.0
uses: actions/setup-node@v4
with:
node-version: '20.9.0'

- name: npm install
run: npm i

- name: Translate with ChatGPT
env:
API_KEY: ${{ secrets.API_KEY }}
run: node auto_translate/script/translate.js

# 変更内容のadd、commit、push処理
- name: Configure Git
Expand Down Expand Up @@ -67,4 +79,4 @@ jobs:
# labels: taranslate
# # delete-branch: true
# # assignees:
# # reviewers:
# # reviewers:

This file was deleted.

1 change: 1 addition & 0 deletions auto_translate/translate/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.9.0
31 changes: 31 additions & 0 deletions auto_translate/translate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation helper

## Install dependencies

```bash
npm i
```

## Set OpenAI API KEY

create `.env.local`:

```bash
export OPENAI_API_KEY="YOUR API KEY HERE"
```

then activate:

```bash
source .env.local
```

## run script

```bash
node translation.js
```

## Warning

- クリップボードへのコピーは Windows 環境で未確認です
Loading

0 comments on commit b870d2d

Please sign in to comment.