DeFiCh/wallet

View on GitHub
.github/workflows/translations-reporter.yml

Summary

Maintainability
Test Coverage
name: "Translations"

on:
  workflow_dispatch:
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  translations:
    name: Missing Report
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
      - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
        with:
          node-version: 20
          cache: "npm"
      - run: npm ci
      - name: Find missing translations
        id: find_string
        run: npm run translation:missing
      - name: Read missing_translations.json
        id: translations
        uses: juliangruber/read-file-action@02bbba9876a8f870efd4ad64e3b9088d3fb94d4b # tag=v1.1.6
        with:
          path: ./missing_translations.json
      - uses: marocchino/sticky-pull-request-comment@f61b6cf21ef2fcc468f4345cdfcc9bda741d2343 # v2.6.2
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          header: Missing Translations
          message: |
            ### Missing Translations Report
            The following translations are missing for this pull request.
            ```json
            ${{ steps.translations.outputs.content }}
            ```
      - name: Send missing translations to Slack workflow
        if: ${{ fromJson(steps.translations.outputs.content).totalMissingCount != 0 }}
        uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
        id: slack_missing_translation_workflow
        with:
          payload-file-path: "./missing_translations.json"
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_MISSING_TRANSLATION_WEBHOOK_URL }}