Skip to content

Commit 1e2976d

Browse files
authored
fix: prompt (#2194)
* fix: prompt * fix: import prompt
1 parent 9c07b2e commit 1e2976d

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

.github/workflows/docs-commit.translate.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ jobs:
3232
run: |
3333
echo "files=$(git diff --diff-filter=d --name-only HEAD^ HEAD | grep '\.md$' | grep -v 'cn' | sed -e 's/^/.\//' | tr '\n' ' ')" >> $GITHUB_OUTPUT
3434
35+
- name: Read prompt from file
36+
id: prompt
37+
run: |
38+
prompt_value=$(cat .github/workflows/prompt.txt | sed ':a;N;$!ba;s/\n/\\n/g')
39+
echo "prompt=$prompt_value" >> $GITHUB_OUTPUT
40+
3541
- name: Run GPT Translate
3642
3743
with:
@@ -40,5 +46,5 @@ jobs:
4046
inputFiles: "${{ steps.changed_files.outputs.files }}"
4147
outputFiles: "docs/cn/**/*.md"
4248
languages: "Simplified-Chinese"
43-
prompt: "$(cat .github/workflows/prompt.txt)"
49+
prompt: "${{ steps.prompt.outputs.prompt }}"
4450
basePath: ${{ secrets.BASE_URL }}

.github/workflows/docs-sync.translate.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ jobs:
4646
echo "Markdown Files Missing: ${{ steps.check_missing.outputs.missing_md_files }}"
4747
echo "JSON Files Missing: ${{ steps.check_missing.outputs.missing_json_files }}"
4848
49+
- name: Read prompt from file
50+
id: prompt
51+
run: |
52+
prompt_value=$(cat .github/workflows/prompt.txt | sed ':a;N;$!ba;s/\n/\\n/g')
53+
echo "prompt=$prompt_value" >> $GITHUB_OUTPUT
54+
4955
- name: Run GPT Translate
5056
5157
with:
@@ -54,5 +60,5 @@ jobs:
5460
inputFiles: "${{ steps.check_missing.outputs.missing_md_files }}${{ steps.check_missing.outputs.missing_json_files }}"
5561
outputFiles: "docs/cn/**/*.{md,json}"
5662
languages: "Simplified-Chinese"
57-
prompt: "$(cat .github/workflows/prompt.txt)"
63+
prompt: "${{ steps.prompt.outputs.prompt }}"
5864
basePath: ${{ secrets.BASE_URL }}

.github/workflows/docs.translate.dir.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ jobs:
4646
echo "Markdown Files Missing: ${{ steps.check_missing.outputs.missing_md_files }}"
4747
echo "JSON Files Missing: ${{ steps.check_missing.outputs.missing_json_files }}"
4848
49+
- name: Read prompt from file
50+
id: prompt
51+
run: |
52+
prompt_value=$(cat .github/workflows/prompt.txt | sed ':a;N;$!ba;s/\n/\\n/g')
53+
echo "prompt=$prompt_value" >> $GITHUB_OUTPUT
54+
4955
- name: Run GPT Translate
5056
5157
with:
@@ -54,5 +60,5 @@ jobs:
5460
inputFiles: "${{ steps.check_missing.outputs.missing_md_files }}${{ steps.check_missing.outputs.missing_json_files }}"
5561
outputFiles: "docs/cn/**/*.{md,json}"
5662
languages: "Simplified-Chinese"
57-
prompt: "$(cat .github/workflows/prompt.txt)"
63+
prompt: "${{ steps.prompt.outputs.prompt }}"
5864
basePath: ${{ secrets.BASE_URL }}

.github/workflows/docs.translate.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313

14+
- name: Read prompt from file
15+
id: prompt
16+
run: |
17+
prompt_value=$(cat .github/workflows/prompt.txt | sed ':a;N;$!ba;s/\n/\\n/g')
18+
echo "prompt=$prompt_value" >> $GITHUB_OUTPUT
19+
1420
- name: Run GPT Translate
1521
if: |
1622
contains(github.event.comment.body, '/gt')
1723
1824
with:
1925
apikey: ${{ secrets.API_KEY }}
2026
model: ${{ secrets.LLM_MODEL }}
21-
prompt: "$(cat .github/workflows/prompt.txt)"
27+
prompt: "${{ steps.prompt.outputs.prompt }}"
2228
basePath: ${{ secrets.BASE_URL }}

0 commit comments

Comments
 (0)