🏡 index : quine-global-labs/mirror-cockpit-project-cockpit.git

name: weblate-sync-po
on:
  schedule:
    # Run this on Tuesday evening (UTC), so that it's ready for release on
    # Wednesday, with some spare time
    - cron: '0 18 * * 2'
  # can be run manually on https://github.com/cockpit-project/cockpit/actions
  workflow_dispatch:

jobs:
  po-refresh:
    environment: self
    permissions:
      pull-requests: write
      statuses: write
    runs-on: ubuntu-latest
    steps:
      - name: Set up dependencies
        run: |
          # disable man-db to speed up package install
          echo "set man-db/auto-update false" | sudo debconf-communicate
          sudo dpkg-reconfigure man-db

          sudo apt update
          sudo apt install -y --no-install-recommends gettext

      - name: Clone source repository
        uses: actions/checkout@v7
        with:
          ssh-key: ${{ secrets.DEPLOY_KEY }}
          path: src

      - name: Clone weblate repository
        uses: actions/checkout@v7
        with:
          repository: ${{ github.repository }}-weblate
          path: weblate

      - name: Copy .po files from weblate repository
        run: cp weblate/*.po src/po/

      - name: Run po-refresh bot
        run: |
          cd src
          test/common/make-bots
          git config --global user.name "GitHub Workflow"
          git config --global user.email "cockpituous@cockpit-project.org"
          mkdir -p ~/.config/cockpit-dev
          echo ${{ github.token }} >> ~/.config/cockpit-dev/github-token
          PO_REFRESH_NO_SYNC=1 bots/po-refresh