From 1945bd45ac22243e0abc19ef8445eb294cffe0ae Mon Sep 17 00:00:00 2001 From: Brian Mesick Date: Mon, 16 Oct 2023 10:07:44 -0400 Subject: [PATCH] refactor: Include input file location in matrix --- .../extract-translation-source-files.yml | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/extract-translation-source-files.yml b/.github/workflows/extract-translation-source-files.yml index 6082410c672..9af2c28abc3 100644 --- a/.github/workflows/extract-translation-source-files.yml +++ b/.github/workflows/extract-translation-source-files.yml @@ -262,8 +262,9 @@ jobs: # using max-parallel to avoid git push/pull issues when running in parallel max-parallel: 1 matrix: - repo: - - tutor-contrib-aspects + repository_config: + - repo: tutor-contrib-aspects + transifex_file_path: transifex_input.yaml runs-on: ubuntu-latest continue-on-error: true @@ -277,11 +278,11 @@ jobs: ref: ${{ needs.setup-branch.outputs.branch }} # Clones the repository - - name: clone openedx/${{ matrix.repo }} + - name: clone openedx/${{ matrix.repository_config.repo }} uses: actions/checkout@v3 with: - repository: openedx/${{ matrix.repo }} - path: translations/${{ matrix.repo }} + repository: openedx/${{ matrix.repository_config.repo }} + path: translations/${{ matrix.repository_config.repo }} # Sets up Python - name: setup python @@ -296,7 +297,7 @@ jobs: # Extracts the translation source files - name: extract translation source files run: | - cd translations/${{ matrix.repo }} + cd translations/${{ matrix.repository_config.repo }} make extract_translations # git adds only the translation source file transifex_input.yaml from @@ -307,31 +308,30 @@ jobs: # set identity git config --global user.email "translations-bot@openedx.org" git config --global user.name "edx-transifex-bot" - # Change directory to translations/${{ matrix.repo }} - cd translations/${{ matrix.repo }} + # Change directory to translations/${{ matrix.repository_config.repo }} + cd translations/${{ matrix.repository_config.repo }} - # remove translations/${{ matrix.repo }}/.git so we don't commit a submodule + # remove translations/${{ matrix.repository_config.repo }}/.git so we don't commit a submodule rm -rf .git - # find transifex_input.yaml - TRANSIFEX_YAML_PATH=$(find . -name 'transifex_input.yaml') + # stage the transifex_input.yaml file generated by make, force it in # case the file is in .gitignore (it should be) - git add $TRANSIFEX_YAML_PATH -f -v + git add ${{ matrix.repository_config.transifex_file_path }} -f -v # Check the git status of the translation source files - echo "GIT_STATUS=$(git status $TRANSIFEX_YAML_PATH -s | wc -l)" >> $GITHUB_ENV + echo "GIT_STATUS=$(git status ${{ matrix.repository_config.transifex_file_path }} -s | wc -l)" >> $GITHUB_ENV # Attempts to commit the translation source files if there is a difference - name: git commit the translation source files if: "${{ env.GIT_STATUS > 0 }}" run: | # commit the changes - git commit -m "chore: add extracted translation source files from ${{ matrix.repo }}" + git commit -m "chore: add extracted translation source files from ${{ matrix.repository_config.repo }}" # push changes to branch git push merge-translations: runs-on: ubuntu-latest - needs: [setup-branch, python-translations, js-translations] + needs: [setup-branch, python-translations, js-translations, generic-translations] steps: # Clones the openedx-translations repo on the automated/extract-translation-source-files-# branch