-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add a new generic translation extraction type #1834
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -254,9 +254,84 @@ jobs: | |
# push changes to branch | ||
git push | ||
|
||
# Non-Django, non-JS repositories with a generic extraction interface. This | ||
# assumes that a `extract_translations` make target exists and will create | ||
# a transifex_input.yaml file in the root of the site. | ||
generic-translations: | ||
strategy: | ||
# using max-parallel to avoid git push/pull issues when running in parallel | ||
max-parallel: 1 | ||
matrix: | ||
repository_config: | ||
- repo: tutor-contrib-aspects | ||
transifex_file_path: transifex_input.yaml | ||
|
||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
needs: [setup-branch] | ||
|
||
steps: | ||
# Clones the openedx-translations repo | ||
- name: clone openedx/openedx-translations | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ needs.setup-branch.outputs.branch }} | ||
|
||
# Clones the repository | ||
- name: clone openedx/${{ matrix.repository_config.repo }} | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: openedx/${{ matrix.repository_config.repo }} | ||
path: translations/${{ matrix.repository_config.repo }} | ||
|
||
# Sets up Python | ||
- name: setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8' | ||
|
||
# Installs Python requirements from translations.txt | ||
- name: install requirements | ||
run: pip install -r requirements/translations.txt | ||
|
||
# Extracts the translation source files | ||
- name: extract translation source files | ||
run: | | ||
cd translations/${{ matrix.repository_config.repo }} | ||
make extract_translations | ||
|
||
# git adds only the translation source file transifex_input.yaml from | ||
# the repo root. | ||
- name: git add the translation source files | ||
id: add-sources | ||
run: | | ||
# set identity | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "edx-transifex-bot" | ||
# Change directory to translations/${{ matrix.repository_config.repo }} | ||
cd translations/${{ matrix.repository_config.repo }} | ||
|
||
# remove translations/${{ matrix.repository_config.repo }}/.git so we don't commit a submodule | ||
rm -rf .git | ||
|
||
# stage the transifex_input.yaml file generated by make, force it in | ||
# case the file is in .gitignore (it should be) | ||
git add ${{ matrix.repository_config.transifex_file_path }} -f -v | ||
# Check the git status of the translation source files | ||
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.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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good.
I'm not sure if it's widely documented, but that's a proper GitHub matrix config to set the item as an object instead of a string.