From 2b8ec1f6b242abd5a01d0d57a3ce3b9c94b50baf Mon Sep 17 00:00:00 2001 From: lorcan-codes <126797224+lorcan-codes@users.noreply.github.com> Date: Mon, 4 Sep 2023 21:40:31 +0500 Subject: [PATCH] Add crowdin workflow changes to redesign --- .github/workflows/crowdin.yml | 19 +++++++++++++++++-- .github/workflows/website.yml | 13 ++++++++++--- workspaces/cms-scripts/src/crowdin.ts | 12 +++++++----- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index e30fb0801a..72dde72a99 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -1,6 +1,8 @@ name: Crowdin Action on: + schedule: + - cron: "0 1 * * *" # every day at 1am UTC workflow_dispatch: concurrency: crowdin-dev @@ -20,6 +22,13 @@ jobs: node-version: 18 cache: yarn + - name: Set date environment variables + run: | + echo "YMDHM=$(date +%Y-%m-%d-%H-%M)" >> $GITHUB_ENV + echo "YMDH=$(date +%Y-%m-%d-%H)" >> $GITHUB_ENV + echo "YMD=$(date +%Y-%m-%d)" >> $GITHUB_ENV + echo "YM=$(date +%Y-%m)" >> $GITHUB_ENV + - name: Cache dependencies uses: actions/cache@v3 with: @@ -41,7 +50,13 @@ jobs: uses: actions/cache/restore@v3 with: path: _crowdin - key: crowdin-cache-${{ github.ref_name }} + key: crowdin-cache-${{ github.ref_name }}-${{ env.YMDHM }} + restore-keys: | + crowdin-cache-${{ github.ref_name }}-${{ env.YMDHM }} + crowdin-cache-${{ github.ref_name }}-${{ env.YMDH }} + crowdin-cache-${{ github.ref_name }}-${{ env.YMD }} + crowdin-cache-${{ github.ref_name }}-${{ env.YM }} + crowdin-cache-${{ github.ref_name }} - name: Run pre-Crowdin script for file preparation run: yarn workspace @starknet-io/cms-scripts pre-crowdin @@ -62,4 +77,4 @@ jobs: uses: actions/cache/save@v3 with: path: _crowdin - key: crowdin-cache-${{ github.ref_name }} + key: crowdin-cache-${{ github.ref_name }}-${{ env.YMDHM }} diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 8d3badb659..85b97ad949 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -47,7 +47,14 @@ jobs: uses: actions/cache/restore@v3 with: path: _crowdin - key: crowdin-cache-dev + key: crowdin-cache-${{ github.ref_name }}-${{ env.YMDHM }} + restore-keys: | + crowdin-cache-${{ github.ref_name }}-${{ env.YMDHM }} + crowdin-cache-${{ github.ref_name }}-${{ env.YMDH }} + crowdin-cache-${{ github.ref_name }}-${{ env.YMD }} + crowdin-cache-${{ github.ref_name }}-${{ env.YM }} + crowdin-cache-${{ github.ref_name }} + crowdin-cache- - name: Restore social media data uses: actions/cache/restore@v3 @@ -86,6 +93,6 @@ jobs: projectName: starknet-website directory: dist/client workingDirectory: workspaces/website - wranglerVersion: '3' + wranglerVersion: "3" gitHubToken: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref_name == 'production' && 'main' || github.ref_name }} \ No newline at end of file + branch: ${{ github.ref_name == 'production' && 'main' || github.ref_name }} diff --git a/workspaces/cms-scripts/src/crowdin.ts b/workspaces/cms-scripts/src/crowdin.ts index 464d0d0675..d3014788e2 100644 --- a/workspaces/cms-scripts/src/crowdin.ts +++ b/workspaces/cms-scripts/src/crowdin.ts @@ -171,11 +171,13 @@ export function handleFields( break; case "markdown": - files.push({ - type: "markdown", - data: data[field.name], - filepath: filepath + "_" + field.name, - }); + if(data[field.name] != null){ + files.push({ + type: "markdown", + data: data[field.name], + filepath: filepath + "_" + field.name, + }); + } break; case "list":