Skip to content

Commit

Permalink
Update docs/decisions/0002-mark-fuzzy-entries.rst
Browse files Browse the repository at this point in the history
Co-authored-by: Brian Smith <[email protected]>
  • Loading branch information
OmarIthawi and brian-smith-tcril committed Oct 26, 2023
1 parent 2512d3a commit ea004f0
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 104 deletions.
127 changes: 127 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Run pull request tests and validation for openedx-translations

name: CI

on:
- pull_request

jobs:
# Run unit and integration tests for Python
python-tests:
runs-on: ubuntu-latest
steps:
# Clones the openedx-translations repo
- name: clone openedx/openedx-translations
uses: actions/checkout@v3

- name: Install gettext
run: |
sudo apt install -y gettext
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Run python tests
run: |
make test_requirements
make test
# Validate translation files
validate-translation-files:
needs: python-tests
runs-on: ubuntu-latest
steps:
- name: Allow editing translation files for bot pull requests
env:
# secrets can't be used in job conditionals, so we set them to env here
TRANSIFEX_APP_ACTOR_NAME: "${{ secrets.TRANSIFEX_APP_ACTOR_NAME }}"
TRANSIFEX_APP_ACTOR_ID: "${{ secrets.TRANSIFEX_APP_ACTOR_ID }}"
if: "${{ github.actor == env.TRANSIFEX_APP_ACTOR_NAME && github.actor_id == env.TRANSIFEX_APP_ACTOR_ID }}"
run: |
echo "VALIDATION_OPTIONS=--mark-fuzzy" >> "$GITHUB_ENV"
- name: Validate translation files
id: validate_translation_files
run: |
has_errors=0
python scripts/validate_translation_files.py $VALIDATION_OPTIONS 2>error_log.txt || has_errors=1
cat error_log.txt # Print the errors to the console for debugging
# Save the validation errors to an output variable
{
echo 'ERROR_LOG<<EOF'
fold -w 100 -s error_log.txt
echo EOF
} >> "$GITHUB_OUTPUT"
exit $has_errors
- name: Commit changes to git
if: ${{ always() && !github.event.pull_request.head.repo.fork }}
run: |
# Commit if there are changes to translation files
if ! git diff --no-ext-diff --quiet --exit-code; then
git config --global user.email "[email protected]"
git config --global user.name "edx-transifex-bot"
git add .
git commit -m "fix: mark invalid entries as fuzzy" -- translations/
fi
- name: Post translation validation results as a pull request comment
# Due to GitHub Actions security reasons posting a comment isn't possible on fork pull requests.
# This shouldn't be an issue, because bots writes directly to this repository.
if: ${{ always() && !github.event.pull_request.head.repo.fork }}
uses: mshick/add-pr-comment@7c0890544fb33b0bdd2e59467fbacb62e028a096
with:
message: |
:white_check_mark: All translation files are valid.
```
${{ steps.validate_translation_files.outputs.ERROR_LOG }}
```
This comment has been posted by the `validate-translation-files.yml` GitHub Actions workflow.
message-failure: |
:warning: There are errors in the translation files:
```
${{ steps.validate_translation_files.outputs.ERROR_LOG }}
```
This comment has been posted by the `validate-translation-files.yml` GitHub Actions workflow.
# Run commitlint on the commit messages in a pull request.
commitlint:
needs: validate-translation-files
uses: openedx/.github/.github/workflows/commitlint.yml@master


# Automatically merge pull requests created by the "Transifex Integration" github app
# https://github.com/apps/transifex-integration
automerge-transifex-app-pr:
needs: commitlint
runs-on: ubuntu-latest
# Merges the pull request
steps:
- name: clone repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: auto-merge pull request
env:
# secrets can't be used in job conditionals, so we set them to env here
TRANSIFEX_APP_ACTOR_NAME: "${{ secrets.TRANSIFEX_APP_ACTOR_NAME }}"
TRANSIFEX_APP_ACTOR_ID: "${{ secrets.TRANSIFEX_APP_ACTOR_ID }}"
# This token requires Write access to the openedx-translations repo
GITHUB_TOKEN: ${{ secrets.EDX_TRANSIFEX_BOT_GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
if: "${{ github.actor == env.TRANSIFEX_APP_ACTOR_NAME && github.actor_id == env.TRANSIFEX_APP_ACTOR_ID }}"
run: |
# Add the pull request to the merge queue with --rebase commit strategy
gh pr merge ${{ github.head_ref }} --rebase --auto
10 changes: 0 additions & 10 deletions .github/workflows/commitlint.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/python-tests.yml

This file was deleted.

60 changes: 0 additions & 60 deletions .github/workflows/validate-translation-files.yml

This file was deleted.

5 changes: 2 additions & 3 deletions docs/decisions/0002-mark-fuzzy-entries.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Mark Transifex invalid entries as fuzzy
#######################################
Mark invalid entries in po files as fuzzy
#########################################

Context
*******
Expand Down Expand Up @@ -96,4 +96,3 @@ Rejected Alternative: Keep pull requests open
.. _OEP-58: https://open-edx-proposals.readthedocs.io/en/latest/architectural-decisions/oep-0058-arch-translations-management.html
.. _LexiQA: https://help.transifex.com/en/articles/6219179-lexiqa
.. _Transifex GitHub App: https://github.com/apps/transifex-integration

0 comments on commit ea004f0

Please sign in to comment.