From f540f7e70cb7211550a512a5f82563bea6a622cf Mon Sep 17 00:00:00 2001 From: Desi McAdam Date: Mon, 22 Apr 2024 15:42:08 -0600 Subject: [PATCH 1/2] Crowdin does not allow slashes - The crowdin cli does not allow slashes in crowdin branch names - Have altered the branch names as they exist on crowdin and - made it such that it will work on the github side and the crowdin - side. --- .github/workflows/crowdin-branch-cleanup.yml | 9 +++++++-- .../crowdin-branch-pr-ready-for-translation.yml | 8 ++++++-- .../crowdin-reusable-translation-download.yml | 10 +++++++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/crowdin-branch-cleanup.yml b/.github/workflows/crowdin-branch-cleanup.yml index 7515abfa034..c2b1aeba589 100644 --- a/.github/workflows/crowdin-branch-cleanup.yml +++ b/.github/workflows/crowdin-branch-cleanup.yml @@ -11,6 +11,7 @@ jobs: outputs: branch: ${{ steps.extract_current_branch.outputs.branch }} pr: ${{ steps.get-prs.outputs.pr }} + modified_branch_name: ${{ steps.extract_modified_branch_name.outputs.modified_branch_name }} steps: - name: Extract current branch name shell: bash @@ -33,7 +34,11 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CURRENT_BRANCH: ${{ steps.extract_current_branch.outputs.branch }} - + + - name: Modified branch name + run: echo "modified_branch_name="${{ steps.extract_current_branch.outputs.branch }} | sed 's#/#-#g'"" >> $GITHUB_OUTPUT + id: extract_modified_branch_name + github_cleanup: runs-on: ubuntu-latest needs: prestep @@ -69,5 +74,5 @@ jobs: if: needs.prestep.outputs.branch != 'main' uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d with: - command: branch delete ${{ needs.prestep.outputs.branch }} + command: ${{ needs.prestep.outputs.modified_branch_name }} command_args: -v diff --git a/.github/workflows/crowdin-branch-pr-ready-for-translation.yml b/.github/workflows/crowdin-branch-pr-ready-for-translation.yml index 36ec31ba547..e3e669280f2 100644 --- a/.github/workflows/crowdin-branch-pr-ready-for-translation.yml +++ b/.github/workflows/crowdin-branch-pr-ready-for-translation.yml @@ -24,6 +24,10 @@ jobs: run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT" id: extract_current_branch + - name: Modified branch name + run: echo "modified_branch_name="${{ steps.extract_current_branch.outputs.branch }} | sed 's#/#-#g'"" >> $GITHUB_OUTPUT + id: extract_modified_branch_name + - name: Checkout uses: actions/checkout@v3 with: @@ -32,7 +36,7 @@ jobs: - name: Crowdin push main as baseline uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d with: - crowdin_branch_name: ${{ steps.extract_current_branch.outputs.branch }} + crowdin_branch_name: ${{ steps.extract_modified_branch_name.outputs.modified_branch_name }} upload_sources: true upload_translations_args: --import-eq-suggestions --auto-approve-imported --verbose upload_translations: true @@ -44,7 +48,7 @@ jobs: - name: Crowdin sources push uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d with: - crowdin_branch_name: ${{ steps.extract_current_branch.outputs.branch }} + crowdin_branch_name: ${{ steps.extract_modified_branch_name.outputs.modified_branch_name }} upload_sources: true upload_sources_args: --auto-update --verbose upload_translations: false diff --git a/.github/workflows/crowdin-reusable-translation-download.yml b/.github/workflows/crowdin-reusable-translation-download.yml index 355beef39f7..53089bbe16f 100644 --- a/.github/workflows/crowdin-reusable-translation-download.yml +++ b/.github/workflows/crowdin-reusable-translation-download.yml @@ -38,18 +38,22 @@ jobs: with: ref: ${{ inputs.branch }} + - name: Modified branch name + run: echo "modified_branch_name="${{ inputs.branch }} | sed 's#/#-#g'"" >> $GITHUB_OUTPUT + id: extract_modified_branch_name + - name: Check translation progress # when main just pull whatever you have (aka skip this) - need to test if: ${{ inputs.branch != 'main' }} uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d with: command: 'status translation' - command_args: '-b ${{ inputs.branch }} --fail-if-incomplete' - + command_args: '-b ${{ steps.extract_modified_branch_name.outputs.modified_branch_name }} --fail-if-incomplete' + - name: Synchronize with Crowdin uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d with: - crowdin_branch_name: ${{ inputs.branch }} + crowdin_branch_name: ${{ steps.extract_modified_branch_name.outputs.modified_branch_name }} upload_sources: false upload_translations: false download_translations: true From 9dd9a44c39cea31b563720ec30e0a94b4c761f34 Mon Sep 17 00:00:00 2001 From: Desi McAdam Date: Mon, 22 Apr 2024 15:57:46 -0600 Subject: [PATCH 2/2] Fix linting errors --- .github/workflows/crowdin-branch-cleanup.yml | 2 +- .github/workflows/crowdin-branch-pr-ready-for-translation.yml | 2 +- .github/workflows/crowdin-reusable-translation-download.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/crowdin-branch-cleanup.yml b/.github/workflows/crowdin-branch-cleanup.yml index c2b1aeba589..1836fe2777c 100644 --- a/.github/workflows/crowdin-branch-cleanup.yml +++ b/.github/workflows/crowdin-branch-cleanup.yml @@ -36,7 +36,7 @@ jobs: CURRENT_BRANCH: ${{ steps.extract_current_branch.outputs.branch }} - name: Modified branch name - run: echo "modified_branch_name="${{ steps.extract_current_branch.outputs.branch }} | sed 's#/#-#g'"" >> $GITHUB_OUTPUT + run: echo "modified_branch_name="${{ steps.extract_current_branch.outputs.branch }} | sed 's#/#-#g'"" >> "$GITHUB_OUTPUT" id: extract_modified_branch_name github_cleanup: diff --git a/.github/workflows/crowdin-branch-pr-ready-for-translation.yml b/.github/workflows/crowdin-branch-pr-ready-for-translation.yml index e3e669280f2..b703f91edff 100644 --- a/.github/workflows/crowdin-branch-pr-ready-for-translation.yml +++ b/.github/workflows/crowdin-branch-pr-ready-for-translation.yml @@ -25,7 +25,7 @@ jobs: id: extract_current_branch - name: Modified branch name - run: echo "modified_branch_name="${{ steps.extract_current_branch.outputs.branch }} | sed 's#/#-#g'"" >> $GITHUB_OUTPUT + run: echo "modified_branch_name="${{ steps.extract_current_branch.outputs.branch }} | sed 's#/#-#g'"" >> "$GITHUB_OUTPUT" id: extract_modified_branch_name - name: Checkout diff --git a/.github/workflows/crowdin-reusable-translation-download.yml b/.github/workflows/crowdin-reusable-translation-download.yml index 53089bbe16f..6d2b6c86aab 100644 --- a/.github/workflows/crowdin-reusable-translation-download.yml +++ b/.github/workflows/crowdin-reusable-translation-download.yml @@ -39,7 +39,7 @@ jobs: ref: ${{ inputs.branch }} - name: Modified branch name - run: echo "modified_branch_name="${{ inputs.branch }} | sed 's#/#-#g'"" >> $GITHUB_OUTPUT + run: echo "modified_branch_name="${{ inputs.branch }} | sed 's#/#-#g'"" >> "$GITHUB_OUTPUT" id: extract_modified_branch_name - name: Check translation progress