66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: doc-translate
|
|
|
|
# on: [push, pull_request]
|
|
on:
|
|
workflow_dispatch: {}
|
|
push:
|
|
branches:
|
|
- doc
|
|
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
doc-translate:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out git repository
|
|
uses: actions/checkout@v4
|
|
|
|
# - name: Check if commit message is "action-generated"
|
|
# id: check_commit_message
|
|
# run: |
|
|
# COMMIT_MESSAGE=$(git log -1 --pretty=format:%s)
|
|
# echo "Commit message: $COMMIT_MESSAGE"
|
|
# if [[ "$COMMIT_MESSAGE" == "action-generated" ]]; then
|
|
# echo "Skipping workflow for action-generated commit"
|
|
# echo "is_generated=true" >> $GITHUB_OUTPUT
|
|
# else
|
|
# echo "is_generated=false" >> $GITHUB_OUTPUT
|
|
# fi
|
|
|
|
# - name: Exit workflow if action-generated commit
|
|
# if: steps.check_commit_message.outputs.is_generated == 'true'
|
|
# run: exit 78
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v3.0.0
|
|
with:
|
|
node-version: "20.19.1"
|
|
registry-url: https://registry.npmjs.org/
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- name: Install -g
|
|
run: npm install -g cross-env zx
|
|
|
|
- name: Install Dependencies
|
|
run: npm install
|
|
|
|
|
|
- run: npx tsx ./translate.mts --test
|
|
env:
|
|
apiKey: ${{secrets.apiKey}}
|
|
baseURL: ${{secrets.baseURL}}
|
|
|
|
- run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add .
|
|
git commit -m "action-generated"
|
|
git push
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |