diff --git a/.github/workflows/update-weblate.yml b/.github/workflows/update-weblate.yml index 9745e477640..3285222ccdc 100644 --- a/.github/workflows/update-weblate.yml +++ b/.github/workflows/update-weblate.yml @@ -13,6 +13,17 @@ jobs: runs-on: ubuntu-latest steps: + # If an open Weblate/translations PR still exists, we shouldn't tell Weblate to push again. + # Because we ended our previous push with a 'reset', Weblate would otherwise force-push + # new changes over the unmerged old changes, causing them to lost. + - name: Check for existence of old Weblate PR + run: | + prs=$(gh pr -R hedyorg/hedy list -q '.[] | select(.title | contains("Translations update"))' --json title) + if [[ "$prs" != "" ]]; then + echo "Open Pull Request for Weblate!" + gh pr -R hedyorg/hedy list --search 'Translations update' + exit 1 + fi - name: Set up Python 3.12 uses: actions/setup-python@v1 with: @@ -38,6 +49,10 @@ jobs: wlc pull wlc commit wlc push - wlc reset + # On our repo, 'wlc reset' consistently times out the TCP connection after waiting + # for 5 minutes. The actual reset does seem to work, so we just don't wait for the + # command to finish, otherwise all our workflow executions show errors. + wlc reset & + sleep 10