Translations import #929
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow imports translations from Launchpad | |
name: Translations import | |
on: | |
schedule: | |
# Runs at 10PM PST | |
- cron: '0 6 * * *' | |
pull_request: | |
branches: [main] | |
paths: | |
- ".github/workflows/translations-import.yml" | |
- "translations/**" | |
jobs: | |
import: | |
name: Import translations from Launchpad | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'connectbot' | |
env: | |
BAZAAR_URI: lp:~kennyr/connectbot/po-output | |
PO_SUBDIR: app/locale | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install bazaar | |
run: | | |
sudo apt-get update && \ | |
sudo apt-get install -y --no-install-recommends \ | |
bzr \ | |
ca-certificates \ | |
rsync | |
- name: Branch Bazaar translation exports | |
run: | | |
cd ${{ runner.temp }} | |
bzr branch lp:~kennyr/connectbot/po-output | |
cd po-output | |
echo "REVNO=$(bzr revno)" >> $GITHUB_ENV | |
- name: Copy exported translations to workspace | |
run: | | |
rsync -av --exclude .bzr \ | |
--exclude '**/oc.po' --exclude '**/[email protected]' --exclude '**/tk.po' \ | |
"${{ runner.temp }}/${BAZAAR_URI##*/}/" "${GITHUB_WORKSPACE}/${PO_SUBDIR}/" | |
echo $REVNO > "${GITHUB_WORKSPACE}/${PO_SUBDIR}/.revno" | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Try importing the translations | |
run: | | |
TRANSLATIONS_ONLY=1 ./gradlew :translations:importToAndroid | |
- name: Create pull request | |
if: github.event_name != 'pull_request' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: | | |
Automated translations import | |
Translations imported from Launchpad. | |
author: Translations Bot <[email protected]> | |
title: '[Translations] Automatic update' | |
body: | | |
Automated import of translations from Launchpad. | |
labels: translations, automated pr | |
assignees: kruton | |
reviewers: kruton | |
branch: translations/import | |
- name: Report pull request creation | |
if: github.event_name != 'pull_request' | |
run: echo "Created pull request number ${{ env.PULL_REQUEST_NUMBER }}" |