-
-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (85 loc) · 3.14 KB
/
update-pot-file.yml
File metadata and controls
103 lines (85 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Update Translation File
on:
push:
branches: [ main ]
paths:
- '*.php'
- '**/*.php'
- '*.js'
- '**/*.js'
- '.github/workflows/update-pot-file.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
env:
PLUGIN_SLUG: enginescript-site-optimizer
POT_FILE: languages/enginescript-site-optimizer.pot
jobs:
update-pot:
name: Regenerate .pot File
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
- name: Install WP-CLI
run: |
curl -fsSL -o wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --version
wp help i18n make-pot >/dev/null
- name: Regenerate .pot file
run: |
mkdir -p "$(dirname "$POT_FILE")"
wp i18n make-pot . "$POT_FILE" \
--slug="$PLUGIN_SLUG" \
--domain="$PLUGIN_SLUG" \
--skip-audit \
--exclude=vendor,node_modules,tests,build,plugin-check-build,.git,.github
test -f "$POT_FILE"
- name: Check for changes
id: changes
run: |
if git diff --quiet --ignore-matching-lines='^"POT-Creation-Date:' -- "$POT_FILE"; then
echo "has_changes=false" >> "$GITHUB_OUTPUT"
echo "Translation file is up to date"
git restore -- "$POT_FILE"
else
echo "has_changes=true" >> "$GITHUB_OUTPUT"
echo "Translation file updated"
git diff --ignore-matching-lines='^"POT-Creation-Date:' -- "$POT_FILE" | head -80
fi
- name: Create Pull Request
if: steps.changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v8
with:
commit-message: 'chore(i18n): regenerate translation template'
title: 'chore(i18n): Update translation template (.pot file)'
body: |
## Translation Template Update
This PR updates the translation template (`.pot` file) based on recent code changes.
### What Changed
The following PHP and JavaScript source files had translatable strings added or modified.
See the diff in this PR for details.
### Next Steps
1. Review the changes in the `.pot` file
2. Approve and merge this PR
3. Translators can then use the updated `.pot` file with their translation tools
---
*This PR was automatically generated by the [Update Translation File](https://github.com/${{ github.repository }}/blob/main/.github/workflows/update-pot-file.yml) workflow.*
add-paths: ${{ env.POT_FILE }}
branch: chore/update-pot-file
base: main
delete-branch: true
labels: 'automation,maintenance'