Skip to content

Commit

Permalink
[CI & i18n] GH action to run i18n-check + new fix GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Jun 7, 2024
1 parent c62b369 commit 018c156
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/workflows/check-i18n.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: i18n

on:
pull_request:

jobs:
i18n-check:
name: I18N check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/i18n-check.sh -u
- run: .github/workflows/scripts/i18n-check-helper.sh
2 changes: 1 addition & 1 deletion .github/workflows/pr-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: |
PR_ACTION=$(echo $COMMENT | grep -oP '/fix:\K\w+')
echo "Action is $PR_ACTION"
ACTION_NAMES="all|dict|filenames|format|markdown|refcache|submodules"
ACTION_NAMES="all|dict|filenames|format|i18n|markdown|refcache|submodules|text"
if [[ ! "$PR_ACTION" =~ ^($ACTION_NAMES)$ ]]; then
echo "Invalid action name: $PR_ACTION"
echo "Action name should be one of: $ACTION_NAMES"
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/scripts/i18n-check-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash -e

echo "For localization docs, see https://opentelemetry.io/docs/contributing/localization"

CHANGES=`git status --porcelain`

if [[ -z $CHANGES ]]; then
echo "All localization pages have the requisit commit hash. <3"
exit;
fi

cat <<EOS
Some i18n pages are missing the 'default_lang_commit' front matter field.
To fix this in your local development environment, run
scripts/i18n-check.sh -u
and commit the changes for your locale. Here are the list of pages that
need to be updated:
---
EOS

echo "$CHANGES"
echo "---"

exit 1
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"fix:dict": "find content layouts -name \"*.md\" -print0 | xargs -0 ./scripts/normalize-cspell-front-matter.pl",
"fix:filenames": "npm run _rename-to-kebab-case",
"fix:format": "npm run format",
"fix:i18n": "scripts/i18n-check.sh -u",
"fix:markdown": "npm run check:markdown -- --fix",
"fix:refcache": "npm run check:links",
"fix:submodules": "npm run _sync",
Expand Down

0 comments on commit 018c156

Please sign in to comment.