diff --git a/.github/workflows/check-weblate-prs.yml b/.github/workflows/check-weblate-prs.yml new file mode 100644 index 000000000..60261ab0b --- /dev/null +++ b/.github/workflows/check-weblate-prs.yml @@ -0,0 +1,36 @@ +name: Block EN Merges on Active Weblate PRs + +on: + pull_request: + paths: + - 'wiki/en/**' + +jobs: + check-weblate: + name: Evaluate Weblate PR Status + runs-on: ubuntu-latest + permissions: + pull-requests: read + + steps: + - name: Check for open Weblate pull requests + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + run: | + # The exact username of the Weblate bot (e.g., 'weblate', 'app/weblate') + # You may need to check a previous Weblate PR to confirm the exact author name. + WEBLATE_AUTHOR="weblate" + + echo "Checking $REPO for open PRs from $WEBLATE_AUTHOR..." + + # Query GitHub API for open PRs from the bot, output as JSON, and count the array length + OPEN_PRS=$(gh pr list --repo "$REPO" --state open --author "$WEBLATE_AUTHOR" --json number -q '. | length') + + if [ "$OPEN_PRS" -gt 0 ]; then + echo "::error::Found $OPEN_PRS open Weblate PR(s). Merging changes to English documentation is blocked to prevent po4a translation conflicts." + exit 1 + else + echo "No open Weblate PRs detected. Safe to proceed." + exit 0 + fi \ No newline at end of file