-
-
Notifications
You must be signed in to change notification settings - Fork 6
54 lines (51 loc) · 1.26 KB
/
test-source.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
---
name: Test source
on:
pull_request:
paths:
- .github/workflows/test-source.yml
- dist/**
- src/**
- action.yml
push:
branches:
- main
defaults:
run:
shell: sh
jobs:
test-source:
name: Source as ${{ matrix.source }}
timeout-minutes: 5
runs-on: ubuntu-latest
env:
TEXT: "Love"
EXPECTED: "Любов"
strategy:
matrix:
source: ["file", "text"]
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Prepare source
id: params
run: |
if [ "${{ matrix.source }}" = "file" ]; then
source="source.txt"
echo "${TEXT}" > "${source}"
else
source="${TEXT}"
fi
echo "source=${source}" >> "$GITHUB_OUTPUT"
- name: Translate
uses: ./
id: translate
with:
provider: "deepl"
lang: "en-uk"
source: "${{ steps.params.outputs.source }}"
api_key: "${{ secrets.DEEPL_API_KEY }}"
- name: Validate translated text
run: |
echo "'${TEXT}' has been translated to '${{ steps.translate.outputs.text }}'"
[ "${{ steps.translate.outputs.text }}" = "${EXPECTED}" ] || exit 1;