Skip to content

Commit

Permalink
update i18n workflow and composer command to commit i18n files if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube committed Jul 3, 2024
1 parent 0a5e49c commit bf5c4c4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/wp-i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,25 @@ jobs:
continue-on-error: true
run: git diff --exit-code

- name: Fail if language files have changes
- name: Warning if language files have changes
if: steps.changes.outcome == 'failure'
run: |
echo "i18n files are out of date"
echo "Please run command (composer run i18n) locally to update them and commit before releasing"
exit 1
- name: Commit web files
if: steps.changes.outcome == 'failure'
run: |
git config --local user.name "${{ github.event.head_commit.author.name }}"
git config --local user.email "${{ github.event.head_commit.author.email }}"
git remote -v
git add -A
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 }}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"i18n-pot": "vendor/bin/wp i18n make-pot . ./languages/wp-plugin-hostgator.pot --headers='{\"Report-Msgid-Bugs-To\":\"https://github.com/newfold-labs/wp-plugin-hostgator/issues\",\"POT-Creation-Date\":\"2023-01-11T20:21:44+00:00\"}' --exclude=assets,tests,src",
"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": "rm languages/*.json && vendor/bin/wp i18n make-json ./languages --no-purge --pretty-print",
"i18n-json": "rm -f languages/*.json && vendor/bin/wp i18n make-json ./languages --no-purge --pretty-print",
"i18n": [
"@i18n-pot",
"@i18n-po",
Expand Down

0 comments on commit bf5c4c4

Please sign in to comment.