Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/i18n workflow #559

Merged
merged 6 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
18 changes: 4 additions & 14 deletions .github/workflows/wp-i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,9 @@ jobs:
continue-on-error: true
run: git diff --exit-code

- name: Commit updated language files
- name: Fail if language files have changes
if: steps.changes.outcome == 'failure'
run: |
git config --local user.name "${GITHUB_ACTOR} "
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote -v
git add './languages'
git commit -m "WordPress I18N triggered by commit ${{ github.sha }}"
git status

- name: Push changes
if: steps.changes.outcome == 'failure'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
echo "i18n files are out of date"
echo "Please run command (composer run i18n) locally to update them and commit before releasing"
exit 1
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
"i18n-po": "vendor/bin/wp i18n update-po ./languages/wp-plugin-hostgator.pot ./languages",
"i18n-mo": "vendor/bin/wp i18n make-mo ./languages",
"i18n-json": "vendor/bin/wp i18n make-json ./languages --no-purge --pretty-print",
"i18n-json-rename": "for f in ./languages/*.json; do mv \"$f\" \"$(echo \"$f\" | sed 's/[0-9a-fA-F]\\{32\\}/hostgator-script/')\"; done",
"i18n": [
"@i18n-pot",
"@i18n-po",
"@i18n-mo"
"@i18n-mo",
"@i18n-json"
]
},
"scripts-descriptions": {
Expand All @@ -68,8 +68,7 @@
"i18n-pot": "Generate a .pot file for translation.",
"i18n-po": "Update existing .po files.",
"i18n-mo": "Generate new language .mo files.",
"i18n-json": "Generate new language .json files.",
"i18n-json-rename": "Rename the language json files to remove the pesky hash."
"i18n-json": "Generate new language .json files."
},
"require": {
"doctrine/inflector": "1.4.4 as 1.3.1",
Expand Down
Loading