Fix - correct workflow file #6
This file contains 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: Run GPT-PO Command | |
on: | |
push: | |
branches: | |
- master # Runs the workflow on push to the master branch | |
jobs: | |
run-gpt-po: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all history for accurate commit history | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' # Adjust this to your project's Node.js version | |
- name: Install gpt-po | |
run: npm install gpt-po # Installs `gpt-po` package locally in `node_modules` | |
- name: Run GPT-PO Command | |
env: | |
API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
npx gpt-po --dir languages --key $API_KEY | |
echo "Translation completed." | |
- name: Check Git Status | |
run: git status # Check if .po files were modified | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
if [ -n "$(git status --porcelain)" ]; then | |
git add languages/*.po | |
git commit -m "Update .po files with new translations" | |
git push | |
else | |
echo "No changes to commit" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |