forked from anmol098/waka-readme-stats
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (75 loc) · 2.34 KB
/
Copy pathtranslate_readme.yml
File metadata and controls
85 lines (75 loc) · 2.34 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Translate Readme
on:
workflow_dispatch:
inputs:
languages:
description: 'Languages to translate (comma-separated)'
required: false
default: 'fr,de,es,ja,zh,ru,pt,ko,hi'
# push:
# paths:
# - 'README.md'
# commenting so contributor translations are not lost
permissions:
contents: write
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
LANGS="${{ github.event.inputs.languages }}"
else
LANGS="fr,de,es,ja,zh,ru,pt,ko,hi"
fi
# Create JSON array for matrix
echo "matrix=$(echo $LANGS | jq -R -c 'split(",")')" >> $GITHUB_OUTPUT
translate:
needs: prepare
runs-on: ubuntu-latest
strategy:
matrix:
lang: ${{ fromJson(needs.prepare.outputs.matrix) }}
steps:
- uses: actions/checkout@v6
- name: Run README Translator
# Use @latest for the most up-to-date release, or @main for the bleeding edge
uses: DataBoySu/databoysu-readme-translator@latest
with:
lang: ${{ matrix.lang }}
- name: Uploading Translation Artifacts
uses: actions/upload-artifact@v7
with:
name: locale-${{ matrix.lang }}
path: locales/README.${{ matrix.lang }}.md
commit:
needs: translate
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref_name }}
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
- name: Pull latest changes
run: git pull origin ${{ github.head_ref || github.ref_name }} --rebase
- name: Download Translations
uses: actions/download-artifact@v8
with:
pattern: locale-*
path: locales
merge-multiple: true
- name: Navigation Bar
uses: DataBoySu/databoysu-readme-translator@latest
with:
mode: navbar
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "✨💖 docs: updated translations & navbar! 🌸✨"
file_pattern: 'README.md locales/*.md'