From 61859747891ca5098cc4388008a3a178495811ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sat, 25 Jan 2025 14:14:23 +0100 Subject: [PATCH] Update repo template to test new .pot file generation --- .copier-answers.yml | 4 +-- .github/workflows/pre-commit.yml | 4 +-- .github/workflows/test.yml | 44 ++++++++++++++++++++++++++++---- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 72fb21a27..ca5687472 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,6 +1,6 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.27 -_src_path: git+https://github.com/OCA/oca-addons-repo-template +_commit: v1.1.2-270-g77e4444 +_src_path: gh:acsone/oca-addons-repo-template additional_ruff_rules: [] ci: GitHub convert_readme_fragments_to_markdown: false diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 38b0ba110..001a8844d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,8 +13,8 @@ jobs: pre-commit: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: "3.11" - name: Get python version diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3bf18e843..c249d803c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest name: Detect unreleased dependencies steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: | for reqfile in requirements.txt test-requirements.txt ; do if [ -f ${reqfile} ] ; then @@ -50,7 +50,7 @@ jobs: ports: - 5432:5432 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: persist-credentials: false - name: Install addons and dependencies @@ -66,6 +66,40 @@ jobs: - uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} - - name: Update .pot files - run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }} - if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'OCA' }} + - name: Prepare .pot files update + run: | + git reset --hard ${{ github.sha }} + oca_export_and_commit_pot + mkdir oca-ci-po-patch && touch oca-ci-po-patch/keep + git format-patch --output-directory=oca-ci-po-patch --keep-subject @{u}..@ */i18n/*.po* + if: matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'OCA' + - uses: actions/upload-artifact@v4 + with: + name: oca-ci-po-patch + path: oca-ci-po-patch + retention-days: 7 + if: matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'OCA' + push-pot: + needs: [test] + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.repository_owner == 'OCA' + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: oca-ci-po-patch + path: oca-ci-po-patch + - name: Configure git user + run: | + git config user.name "oca-ci" + git config user.email "oca-ci@odoo-community.org" + - name: Apply .pot files changes + run: git am --keep oca-ci-po-patch/*.patch + if: ${{ hashFiles('oca-ci-po-patch/*.patch') != '' }} + - name: Push .pot file changes + run: git push + if: ${{ hashFiles('oca-ci-po-patch/*.patch') != '' }} + # Don't fail in case something has changed upstream in the meantime + continue-on-error: true