From 3cee3bd92ddbc4e44f1f720b815804e4a611c263 Mon Sep 17 00:00:00 2001 From: UnschooledGamer <76094069+UnschooledGamer@users.noreply.github.com> Date: Wed, 12 Nov 2025 21:00:02 +0530 Subject: [PATCH] feat: Add translation check workflow for pull requests * Introduced a new GitHub Actions workflow to check for changes in translation files & a new workflow for labeling based upon the changed files on pull requests. * The workflow detects changes in JSON files located in the src/lang directory and runs a lint check if any changes are found. * Added a Workflow to label Pull requests based on their changed files. --- .github/labeler.yml | 13 ++++++++++++ .github/workflows/add-pr-labels.yml | 17 ++++++++++++++++ .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/add-pr-labels.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..848bd7a5c --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,13 @@ +translations: + - any: + - changed-files: + - any-glob-to-any-file: 'src/lang/*.json' + +docs: + - any: + - changed-files: + - any-glob-to-any-file: '**/*.md' + +enhancement: + - any: + - head-branch: ['^feature', 'feature', '^feat', '^add'] \ No newline at end of file diff --git a/.github/workflows/add-pr-labels.yml b/.github/workflows/add-pr-labels.yml new file mode 100644 index 000000000..f9b979fbb --- /dev/null +++ b/.github/workflows/add-pr-labels.yml @@ -0,0 +1,17 @@ +name: Add Pull Requests Labels +on: + pull_request_target: + types: [opened] + +jobs: + add-labels: + timeout-minutes: 5 + runs-on: ubuntu-latest + + if: github.event.action == 'opened' + permissions: + contents: read + pull-requests: write + + steps: + - uses: actions/labeler@v6 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 788d228c4..0ae6e0907 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,3 +33,34 @@ jobs: - name: Run Biome run: biome ci . + + translation-check: + name: Translation Check (On PR Only) + timeout-minutes: 5 + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + if: github.event_name == 'pull_request' + steps: + - name: Checkout Repository + uses: actions/checkout@v5 + - name: Use Node.js + uses: actions/setup-node@v5 + with: + cache: npm + cache-dependency-path: '**/package-lock.json' + + - name: Detect Changed Files + uses: dorny/paths-filter@v3 + id: file-changes + with: + list-files: shell + filters: | + translation: + - 'src/lang/*.json' + token: ${{ secrets.GITHUB_TOKEN }} + - name: Translation Files Check (if changed) + if: steps.file-changes.outputs.translation == 'true' + run: | + npm run lint check \ No newline at end of file