Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 50 additions & 7 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,21 @@ env:
PYDOC_LANGUAGE: pt_BR
PYDOC_TX_PROJECT: ${{ inputs.tx_project }}
PYDOC_VERSION: ${{ inputs.version }}
PYDOC_LANG_DIR: ${{ inputs.version }}
TX_CLI_VERSION: '1.6.17'

jobs:
sync:
runs-on: ubuntu-latest
permissions:
contents: read
steps:

# 1- Set up environment

- name: Check out this repository
uses: actions/checkout@v6

- name: Set language dir variable
run:
echo "PYDOC_LANG_DIR=${{ env.PYDOC_VERSION }}" >> $GITHUB_ENV

- name: Checkout this repository ${{ env.PYDOC_VERSION }}
uses: actions/checkout@v6
with:
Expand Down Expand Up @@ -107,7 +106,53 @@ jobs:
env:
PYDOC_LANG_DIR: ${{ env.PYDOC_LANG_DIR }}

# 4- Commit and push translations
- name: Upload translation artifacts
uses: actions/upload-artifact@v7
with:
name: python-${{ env.PYDOC_VERSION }}
path: |
.tx/config
potodo.md
stats.json
*.po
**/*.po

commit:
runs-on: ubuntu-latest
needs: sync
permissions:
contents: write
steps:

# 1- Set up environment

- name: Check out this repository
uses: actions/checkout@v6

- name: Checkout this repository ${{ env.PYDOC_VERSION }}
uses: actions/checkout@v6
with:
ref: ${{ env.PYDOC_VERSION }}
path: ${{ env.PYDOC_LANG_DIR }}

- uses: actions/setup-python@v6
with:
python-version: ${{ inputs.version }}
allow-prereleases: true
cache: 'pip'
pip-install: -r requirements.txt

# 2- Remove PO files and the download files (excluding obsolete)

- name: Clean PO files
run: find ${{ env.PYDOC_LANG_DIR }} -name '*.po' | xargs -r rm

- name: Download translation artifacts
uses: actions/download-artifact@v8
with:
name: python-${{ env.PYDOC_VERSION }}

# 3- Commit and push changed files depending on the event name

- name: Commit
run: ./scripts/commit.sh
Expand All @@ -119,5 +164,3 @@ jobs:
run: |
cd ./${{ env.PYDOC_LANG_DIR }}
git push


4 changes: 2 additions & 2 deletions scripts/commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ extra_files=".tx/config stats.json potodo.md"

set +u
if [ -n "${CI+x}" ]; then
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions"
fi
set -u

Expand Down
Loading