Skip to content

Commit

Permalink
refactor: Include input file location in matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
bmtcril authored and OmarIthawi committed Oct 17, 2023
1 parent a51cd8a commit 1945bd4
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/extract-translation-source-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -307,31 +308,30 @@ jobs:
# set identity
git config --global user.email "[email protected]"
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
Expand Down

0 comments on commit 1945bd4

Please sign in to comment.