-
SummaryI tried to trigger this workflow through Additional informationname: GPT Translate by Input
on:
workflow_dispatch:
inputs:
path:
description: 'The path to the directory containing the files to translate (e.g., docs/sql-reference/)'
required: true
default: 'sql-reference'
permissions:
id-token: write
pull-requests: write
checks: write
statuses: write
contents: write
jobs:
gpt_translate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Delete all files in specified cn directory
run: |
TRANSLATION_DIR="docs/${{ github.event.inputs.path }}"
CN_DIR="docs/cn/${{ github.event.inputs.path }}"
echo "Deleting all files in $CN_DIR"
rm -rf $CN_DIR
echo "All files in $CN_DIR have been deleted."
git add .
- name: Get all files in specified directory
id: all_files
run: |
TRANSLATION_DIR="docs/${{ github.event.inputs.path }}"
echo "files=$(find $TRANSLATION_DIR -type f -name '*.md' | sed -e 's/^/.\//' | tr '\n' ' ')" >> $GITHUB_OUTPUT
- name: Run GPT Translate
uses: 3ru/gpt-translate@master
with:
apikey: ${{ secrets.OPENAI_API_KEY }}
model: "gpt-4-turbo-preview"
inputFiles: '${{ steps.all_files.outputs.files }}'
outputFiles: 'docs/cn/**/*.md'
languages: 'Simplified-Chinese'
prompt: "You are a translation engine that has knowledge of databases and is familiar with SQL, HTML and Markdown syntax. \ Databend is a cloud-native data warehouse and an alternative to Snowflake. \ I am translating the Databend documentation for helping users.\ Translate the Markdown content I'll paste later into {targetLanguage}.\ You must strictly follow the rules below.\ - Never change the Markdown markup structure. Don't add or remove links. Do not change any URL.\ - Never change the contents of code blocks even if they appear to have a bug.\ - Always preserve the original line breaks. Do not add or remove blank lines.\ - Never touch the permalink such as `{/*examples*/}` at the end of each heading.\ - Never touch HTML-like tags such as `<Notes>`.\ - Correctly format the document for best rendering."
token: ${{ secrets.GITHUB_TOKEN }} Examplehttps://github.com/datafuselabs/databend-docs/actions/runs/7690600375/job/20954644583 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
@PsiACE |
Beta Was this translation helpful? Give feedback.
-
thanks @3ru , It can run normally now, but the output files is not quite as expected. I would like to ask for your help in checking how to write it correctly. I hope |
Beta Was this translation helpful? Give feedback.
-
@PsiACE
To achieve your requirements, you need to do like this outputFiles: 'docs/cn/${{ github.event.inputs.path }}/**/*.md' |
Beta Was this translation helpful? Give feedback.
@PsiACE
It was caused by not supporting
workflow_dispatch
, now that it is supported in v1.1.9, could you please run and try again?