added docs

This commit is contained in:
Manindra de Mel 2023-10-27 01:25:34 +11:00
parent cf9e4a2769
commit a06b123e43

View File

@ -1,6 +1,6 @@
name: Translate Readme
on:
on: # This workflow triggers on pushes and PRs to the main branch, specifically affecting the README.md
push:
branches: [ main ]
paths:
@ -9,7 +9,7 @@ on:
branches: [ main ]
paths:
- 'README.md'
workflow_dispatch:
workflow_dispatch: # Also provides a manual trigger option
jobs:
Translate:
@ -19,10 +19,10 @@ jobs:
pull-requests: write
steps:
- name: Checkout
- name: Checkout # Fetches the current repo's content
uses: actions/checkout@v3
- name: Upload to Crowdin
- name: Upload to Crowdin # Uploads any changes in specified files to Crowdin
uses: crowdin/github-action@v1
with:
command: 'upload'
@ -32,7 +32,7 @@ jobs:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Apply Machine Translation
- name: Apply Machine Translation # Applies machine translation to the new content in various languages
uses: crowdin/github-action@v1
with:
command: 'pre-translate'
@ -42,7 +42,7 @@ jobs:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Download from Crowdin
- name: Download from Crowdin # Downloads the translated files from Crowdin
uses: crowdin/github-action@v1
with:
download_translations: true
@ -52,35 +52,32 @@ jobs:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Set Git Identity
- name: Set Git Identity # This sets the identity for the git user to clearly indicate that changes are made by the GitHub Action.
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Adjust .git permissions
- name: Adjust .git permissions # Adjusting permissions ensures that the GitHub Action has the required permissions to perform subsequent operations.
run: sudo chmod -R 777 .git
- name: Switch to new branch
- name: Switch to new branch # It switches to a dedicated branch for Crowdin translations. This keeps translations separate until they're ready to be merged.
run: |
git checkout l10n_crowdin_translations
- name: Update paths for translated READMEs
- name: Update paths for translated READMEs # This step updates the paths in the translated READMEs, ensuring links and image sources point to the correct locations.
run: |
find readme -name "README-*.md" -exec sed -i 's|href="\./|href="../|g' {} \;
find readme -name "README-*.md" -exec sed -i 's|src="\./|src="../|g' {} \;
find readme -name "README-*.md" -exec sed -i "s|href='\./|href='../|g" {} \;
find readme -name "README-*.md" -exec sed -i "s|src='\./|src='../|g" {} \;
- name: Commit changes
- name: Commit changes # After updating paths, it commits and pushes the changes to the branch designated for translations.
run: |
git add -A
git commit -m "Update paths in translated READMEs"
git push origin l10n_crowdin_translations
- name: Create PR with new translations
- name: Create PR with new translations # The final step in the process is to create a Pull Request with the new translations. Once reviewed and approved, the translations can be merged into the main branch.
uses: crowdin/github-action@v1
with:
create_pull_request: true