name: L10n
on:
  workflow_dispatch:
  push:
    branches:
      - master
    paths:
      - 'user_manual/**'
      - '!user_manual/locale/**'

jobs:
  user_manual:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
      - uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4
        with:
          python-version: '3.12'
          cache: 'pip'
      - name: Install pip dependencies
        run: pip install -r requirements.txt
      - name: Build using Makefile
        run: cd user_manual && make gettext

      - uses: peter-evans/create-pull-request@v5
        id: cpr
        with:
          token: ${{ secrets.COMMAND_BOT_PAT }}
          commit-message: "chore(l10n): Updates catalog templates (POT files fetched automatically by transifex)"
          title: Updates catalog templates
          branch: update-l10n
          signoff: true
