From e2ecbee9554c41793b5f271e3a25284e7031b88b Mon Sep 17 00:00:00 2001 From: Sarina Canelake Date: Mon, 6 Nov 2023 15:26:08 -0500 Subject: [PATCH] build: Run validate PO file wkflow only if PO files were changed --- .github/workflows/validate-translation-files.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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