diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 16e2d443f4c..14908845faf 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -10,22 +10,37 @@ jobs: runs-on: ubuntu-latest steps: + # Define which file extensions, when touched, should trigger the + # Python tests, so we can skip this Action if we've only touched .po files + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + non_pofiles: + - '**.txt' + - '**.yml' + - '**.in' + - '**.py' + # Clones the openedx-translations repo - name: clone openedx/openedx-translations uses: actions/checkout@v3 - name: Install gettext + if: steps.filter.outputs.non_pofiles == 'true' run: | sudo apt install -y gettext # Sets up Python - name: setup python + if: steps.filter.outputs.non_pofiles == 'true' uses: actions/setup-python@v4 with: python-version: '3.8' # Run the script - name: run python tests + if: steps.filter.outputs.non_pofiles == 'true' run: | make test_requirements make test diff --git a/.github/workflows/validate-translation-files.yml b/.github/workflows/validate-translation-files.yml index 79eaa78ab42..a06544e84b2 100644 --- a/.github/workflows/validate-translation-files.yml +++ b/.github/workflows/validate-translation-files.yml @@ -3,7 +3,7 @@ name: Validate translation PO files on: - pull_request: + - pull_request jobs: validate-po-files: @@ -12,16 +12,28 @@ jobs: contents: read pull-requests: write steps: + # Define .po filepaths, so we can skip this action unless a .po + # file has been modified in this diff + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + pofiles: + - '**.po' + # Clones the openedx-translations repo - name: clone openedx/openedx-translations + if: steps.filter.outputs.pofiles == 'true' uses: actions/checkout@v3 - name: Install gettext + if: steps.filter.outputs.pofiles == 'true' run: | sudo apt install -y gettext - name: Validate translation files id: validate_translation_files + if: steps.filter.outputs.pofiles == 'true' run: | has_validation_errors=0 python scripts/validate_translation_files.py 2>validation_errors.txt || has_validation_errors=1