|
4 | 4 | pull_request: |
5 | 5 | paths: |
6 | 6 | - 'resources/translations/**/*.xlf' |
| 7 | + - 'composer.lock' |
| 8 | + - 'composer.json' |
7 | 9 |
|
8 | 10 | jobs: |
9 | 11 | validate-xliff: |
10 | 12 | runs-on: ubuntu-22.04 |
| 13 | + |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + php: ['8.1'] |
| 18 | + |
11 | 19 | steps: |
12 | | - - uses: actions/checkout@v4 |
13 | | - - uses: php-actions/composer@v6 |
14 | | - - name: Validate XLIFF XML |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup PHP |
| 24 | + uses: shivammathur/setup-php@v2 |
| 25 | + with: |
| 26 | + php-version: ${{ matrix.php }} |
| 27 | + extensions: imap, zip |
| 28 | + tools: composer:v2 |
| 29 | + coverage: none |
| 30 | + |
| 31 | + - name: Cache Composer packages |
| 32 | + uses: actions/cache@v4 |
| 33 | + with: |
| 34 | + path: | |
| 35 | + ~/.composer/cache/files |
| 36 | + key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 37 | + restore-keys: | |
| 38 | + ${{ runner.os }}-composer-${{ matrix.php }}- |
| 39 | +
|
| 40 | + - name: Install dependencies (no dev autoloader scripts) |
15 | 41 | run: | |
16 | | - sudo apt-get update && sudo apt-get install -y libxml2-utils |
17 | | - find translations -name '*.xlf' -print0 | xargs -0 -n1 xmllint --noout |
| 42 | + set -euo pipefail |
| 43 | + composer install --no-interaction --no-progress --prefer-dist |
| 44 | +
|
| 45 | + - name: Lint XLIFF with Symfony |
| 46 | + run: | |
| 47 | + set -euo pipefail |
| 48 | + # Adjust the directory to match your repo layout |
| 49 | + php bin/console lint:xliff resources/translations |
| 50 | +
|
| 51 | + - name: Validate XLIFF XML with xmllint |
| 52 | + run: | |
| 53 | + set -euo pipefail |
| 54 | + sudo apt-get update |
| 55 | + sudo apt-get install -y --no-install-recommends libxml2-utils |
| 56 | + # Adjust root dir; prune vendor; accept spaces/newlines safely |
| 57 | + find resources/translations -type f -name '*.xlf' -not -path '*/vendor/*' -print0 \ |
| 58 | + | xargs -0 -n1 xmllint --noout |
| 59 | +
|
18 | 60 | - name: Symfony translation sanity (extract dry-run) |
19 | 61 | run: | |
20 | | - composer install --no-interaction --no-progress |
21 | | - php bin/console translation:extract en --format=xlf --domain=messages --no-interaction |
| 62 | + set -euo pipefail |
| 63 | + # Show what would be created/updated without writing files |
| 64 | + php bin/console translation:extract en \ |
| 65 | + --format=xlf \ |
| 66 | + --domain=messages \ |
| 67 | + --dump-messages \ |
| 68 | + --no-interaction |
| 69 | + # Note: omit --force to keep this a dry-run |
0 commit comments