Skip to content

Commit

Permalink
chore: Update localization check workflow to include new language files
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocjohn committed Aug 15, 2024
1 parent af32707 commit 9ae70da
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/check-localization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Check Localization Changes

on:
pull_request:
paths:
- 'src/languages/*.json'
- 'src/localize/string.json'
workflow_dispatch:
permissions:
contents: read
issues: write
pull-requests: write

jobs:
check-localization:
runs-on: ubuntu-latest
env:
hasIssues: false

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install dependencies
run: npm install json5

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v34

- name: Run localization check
id: check-localization
run: node scripts/check-localization.js ${{ steps.changed-files.outputs.all_changed_files }}

- name: Check if diff-report.md exists
id: check-diff-report
run: |
if [ -f scripts/diff-report.md ]; then
echo "hasIssues=true" >> $GITHUB_ENV
fi
- name: Add PR comment if there are issues
if: env.hasIssues == 'true'
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const diffReport = fs.readFileSync('scripts/diff-report.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: diffReport
});
- name: Fail if there are issues
if: env.hasIssues == 'true'
run: exit 1

0 comments on commit 9ae70da

Please sign in to comment.