-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yml
67 lines (64 loc) · 2.07 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: 'DeepL Translate Github Action'
author: 'Estee Tey'
description: 'Translate any document using DeepL Translate API'
inputs:
target_languages:
description: "Target languages to translate to"
required: true
excluded_languages:
description: "Languages to exclude from translation"
required: false
input_file_path:
description: "Path of the file you want to translate"
required: true
output_file_name_pattern:
description: "Pattern of the output file name, including the folder name"
required: true
deepl_api_key:
description: "API Key for DeepL API"
required: true
ignore_terms:
description: "Terms to ignore when translating"
required: false
no_translate_start_tag:
description: "Start tag to ignore when translating"
required: false
default: <!-- notranslate -->
no_translate_end_tag:
description: "End tag to ignore when translating"
required: false
default: <!-- /notranslate -->
runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v3
- name: Run translation script
shell: bash
env:
target_languages: ${{ inputs.target_languages }}
input_file_path: ${{ inputs.input_file_path }}
output_file_name_prefix: ${{ inputs.output_file_name_prefix }}
output_file_name_pattern: ${{ inputs.output_file_name_pattern }}
deepl_api_key: ${{ inputs.deepl_api_key }}
ignore_terms: ${{ inputs.ignore_terms }}
no_translate_start_tag: ${{ inputs.no_translate_start_tag }}
no_translate_end_tag: ${{ inputs.no_translate_end_tag }}
run: |
cd ${{github.action_path}} && yarn install && yarn start
- name: remove unused temp file if it exists
shell: bash
run: |
if [ -f to_translate.txt ]; then
rm to_translate.txt
else
echo "to_translate.txt does not exist, skipping step"
fi
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: translation of ${{ inputs.input_file_path }}
branding:
icon: 'activity'
color: 'blue'