-
Notifications
You must be signed in to change notification settings - Fork 448
68 lines (68 loc) · 2.31 KB
/
translate.yaml
File metadata and controls
68 lines (68 loc) · 2.31 KB
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
68
name: Translate Docs
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
on:
push:
branches:
- main
paths:
- "docs/*"
permissions:
contents: write
pull-requests: write
jobs:
build:
name: Translate Docs
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- id: md_files
run: |
FILES=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" -- 'docs/*.md')
FILES=$(echo "$FILES" | xargs -n1 basename | tr '\n' ' ')
[ -z "$FILES" ] && echo "found=false" >> "$GITHUB_OUTPUT" || echo "found=true" >> "$GITHUB_OUTPUT"
echo "files=$FILES" >> "$GITHUB_OUTPUT"
- name: Set up PHP
if: steps.md_files.outputs.found == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
- name: run translation script
if: steps.md_files.outputs.found == 'true'
env:
GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}'
MD_FILES: '${{ steps.md_files.outputs.files }}'
run: |
php ./docs/translate.php "$MD_FILES"
- name: Run Linter
if: steps.md_files.outputs.found == 'true'
uses: super-linter/super-linter/slim@v8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: /
MARKDOWN_CONFIG_FILE: .markdown-lint.yaml
FIX_NATURAL_LANGUAGE: true
FIX_MARKDOWN: true
- name: Create Pull Request
if: steps.md_files.outputs.found == 'true'
uses: peter-evans/create-pull-request@v8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: "docs: update translations"
commit-message: "docs: update translations"
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
branch: translations/${{ github.run_id }}
delete-branch: true
body: |
Translation updates for: ${{ steps.md_files.outputs.files }}.
labels: |
translations
bot
draft: false