Skip to content

translate-articles

translate-articles #43

name: translate-articles
on:
schedule:
- cron: '0 13 * * 6'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js environment
uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
cache-dependency-path: scripts/package-lock.json
- name: Install
run: cd ${GITHUB_WORKSPACE}/scripts && npm ci
- name: Translate latest articles
id: translate-latest-articles
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL_ID: ${{ vars.MAIN_SLACK_CHANNEL_ID }}
run: |
set -eu
cd ${GITHUB_WORKSPACE}/scripts
npm run translate:en
cat translated.json
{
echo 'translated<<EOF'
cat translated.json
echo ''
echo EOF
} >> $GITHUB_OUTPUT
- name: Commit and Create Pull request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "feat: Add English-translated articles"
author: "mameka <[email protected]>"
branch: auto-translation
delete-branch: true
title: "[no-image] Add English-translated articles"
body: >
Check auto English-translated articles.
The following articles have been translated.
```json
${{ steps.translate-latest-articles.outputs.translated }}
```
reviewers: kudoh
labels: bot