Pull locales from POEditor #4076
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
name: Pull locales from POEditor | |
on: | |
workflow_dispatch: | |
inputs: | |
poeditor_project_id: | |
required: true | |
description: "POEditor Project ID" | |
type: number | |
schedule: | |
- cron: "0 * * * *" | |
env: | |
PHP_VERSION: 8.3 | |
jobs: | |
pull-locales: | |
name: Pull locales from POEditor | |
runs-on: ubuntu-latest | |
services: | |
mariadb: | |
image: mariadb:11 | |
ports: | |
- 3306 | |
env: | |
MYSQL_USER: user | |
MYSQL_PASSWORD: password | |
MYSQL_DATABASE: test | |
MYSQL_ROOT_PASSWORD: password | |
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=5s --health-timeout=2s --health-retries=3 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Verify MariaDB connection | |
env: | |
PORT: ${{ job.services.mariadb.ports[3306] }} | |
run: | | |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do | |
sleep 1 | |
done | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
extensions: bcmath, ctype, fileinfo, json, mbstring, dom, ldap, pdo, tokenizer, xml, mysql, sqlite | |
coverage: pcov | |
- name: Copy .env | |
run: php -r "copy('.env.ci', '.env');" | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install php dependencies | |
run: | | |
composer self-update | |
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Generate key | |
run: php artisan key:generate | |
- name: Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Migrate Database | |
env: | |
DB_HOST: 127.0.0.1 | |
DB_PORT: ${{ job.services.mariadb.ports[3306] }} | |
DB_DATABASE: test | |
DB_USERNAME: root | |
DB_PASSWORD: password | |
run: php artisan migrate --no-interaction -vvv --force | |
- name: Execute command to pull locales from POEditor | |
env: | |
DB_HOST: 127.0.0.1 | |
DB_PORT: ${{ job.services.mariadb.ports[3306] }} | |
DB_DATABASE: test | |
DB_USERNAME: root | |
DB_PASSWORD: password | |
POEDITOR_TOKEN: ${{ secrets.POEDITOR_TOKEN }} | |
POEDITOR_PROJECT: ${{ github.event.inputs.poeditor_project_id || secrets.POEDITOR_PROJECT}} | |
run: php artisan locales:import | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: Update locales | |
add-paths: "lang/**/*.php" | |
branch: update-locales | |
title: Update locales using POEditor | |
body: This PR was automatically created using the most recent translations from POEditor. |