Skip to content

Commit

Permalink
Merge pull request #1205 from Zeit-Labs/shadinaif/glob-pattern
Browse files Browse the repository at this point in the history
revert: allow pulling translations by module name rather than repo name
  • Loading branch information
OmarIthawi authored Sep 21, 2023
2 parents dc4b813 + d5561c3 commit 7109c40
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 152 deletions.
89 changes: 30 additions & 59 deletions .github/workflows/extract-translation-source-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,46 +39,26 @@ jobs:
max-parallel: 1
matrix:
repo:
# Note: Add `python_module_name` for all edx-platform plugins and XBlocks such as DoneXBlock and completion,
# but not for micrsoervices and IDAs such as course-discovery and credentials.
- repo_name: AudioXBlock
python_module_name: audio
- repo_name: completion
python_module_name: completion
- repo_name: course-discovery # not a plugin
- repo_name: credentials # not a plugin
- repo_name: DoneXBlock
python_module_name: done
- repo_name: edx-ace
python_module_name: edx_ace
- repo_name: edx-bulk-grades
python_module_name: bulk_grades
- repo_name: edx-ora2
python_module_name: openassessment
- repo_name: edx-proctoring
python_module_name: edx_proctoring
- repo_name: FeedbackXBlock
python_module_name: feedback
- repo_name: RecommenderXBlock
python_module_name: recommender
- repo_name: xblock-drag-and-drop-v2
python_module_name: drag_and_drop_v2
- repo_name: xblock-free-text-response
python_module_name: freetextresponse
- repo_name: xblock-google-drive
python_module_name: google_drive
- repo_name: xblock-image-explorer
python_module_name: image_explorer
- repo_name: xblock-image-modal
python_module_name: imagemodal
- repo_name: xblock-lti-consumer
python_module_name: lti_consumer
- repo_name: xblock-qualtrics-survey
python_module_name: qualtricssurvey
- repo_name: xblock-sql-grader
python_module_name: sql_grader
- repo_name: xblock-submit-and-compare
python_module_name: submit_and_compare
- AudioXBlock
- completion
- course-discovery
- credentials
- DoneXBlock
- edx-ace
- edx-bulk-grades
- edx-ora2
- edx-proctoring
- FeedbackXBlock
- RecommenderXBlock
- xblock-drag-and-drop-v2
- xblock-free-text-response
- xblock-google-drive
- xblock-image-explorer
- xblock-image-modal
- xblock-lti-consumer
- xblock-qualtrics-survey
- xblock-sql-grader
- xblock-submit-and-compare

runs-on: ubuntu-latest
continue-on-error: true
Expand All @@ -96,11 +76,11 @@ jobs:
run: sudo apt install -y gettext

# Clones the repository
- name: clone openedx/${{ matrix.repo.repo_name }}
- name: clone openedx/${{ matrix.repo }}
uses: actions/checkout@v3
with:
repository: openedx/${{ matrix.repo.repo_name }}
path: translations/${{ matrix.repo.repo_name }}
repository: openedx/${{ matrix.repo }}
path: translations/${{ matrix.repo }}

# Sets up Python
- name: setup python
Expand All @@ -115,13 +95,13 @@ jobs:
# Extracts the translation source files
- name: extract translation source files
run: |
cd translations/${{ matrix.repo.repo_name }}
cd translations/${{ matrix.repo }}
make extract_translations
# Validate compilation of translation source files
- name: validate compilation of translation source files
run: |
cd translations/${{ matrix.repo.repo_name }}
cd translations/${{ matrix.repo }}
django-admin compilemessages --locale en
# git adds only the translation source files, found in conf/locale/en
Expand All @@ -131,19 +111,19 @@ jobs:
# set identity
git config --global user.email "[email protected]"
git config --global user.name "edx-transifex-bot"
# Change directory to translations/${{ matrix.repo.repo_name }}
cd translations/${{ matrix.repo.repo_name }}
# Change directory to translations/${{ matrix.repo }}
cd translations/${{ matrix.repo }}
# finds the directory containing the english locale usually located in
# */*/conf/locale/en
EN_DIR=$(find . -type d -regex ".+conf\/locale\/en$")
# If the directory is not found, exit with an error. This can happen if we add a repository that doesn't
# comply with OEP-58, or it still doesn't have any translations yet
if [ -z "$EN_DIR" ]; then
echo "Missing English locale directory for ${{ matrix.repo.repo_name }}!"
echo "Missing English locale directory for ${{ matrix.repo }}!"
echo "exiting with error!"
exit 1
fi
# remove translations/${{ matrix.repo.repo_name }}/.git so we don't commit a submodule
# remove translations/${{ matrix.repo }}/.git so we don't commit a submodule
rm -rf .git
# finds the django.po and djangojs.po files generated by make
# extract_translations into EN_DIR and adds them
Expand All @@ -170,21 +150,12 @@ jobs:
# Check the git statuses of the translation source files
echo "GIT_STATUS=$(git status $DJANGO_PATH $DJANGOJS_PATH -s | wc -l)" >> $GITHUB_ENV
- name: create plugin/xblock link
if: ${{ matrix.repo.python_module_name }}
run: |
cd translations/edx-platform-links
if [ ! -d "${{ matrix.repo.python_module_name }}" ]; then
ln -sd ../${{ matrix.repo.repo_name }}/${{ matrix.repo.python_module_name }} ${{ matrix.repo.python_module_name }}
git add ${{ matrix.repo.python_module_name }}
fi
# 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.repo_name }}"
git commit -m "chore: add extracted translation source files from ${{ matrix.repo }}"
# push changes to branch
git push
Expand Down
75 changes: 0 additions & 75 deletions translations/edx-platform-links/README.rst

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/audio

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/bulk_grades

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/completion

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/done

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/drag_and_drop_v2

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/edx_ace

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/edx_proctoring

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/feedback

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/freetextresponse

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/google_drive

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/image_explorer

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/imagemodal

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/lti_consumer

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/openassessment

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/qualtricssurvey

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/recommender

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/sql_grader

This file was deleted.

1 change: 0 additions & 1 deletion translations/edx-platform-links/submit_and_compare

This file was deleted.

0 comments on commit 7109c40

Please sign in to comment.