From 33af9b876f3e3c02fb09ef365ced5739d9e101fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 2 Jun 2024 21:04:21 +0200 Subject: [PATCH] Simplify github workflow: peter-evans/create-pull-request@v6 already checks if diff exists --- .github/workflows/auto_messages_pot.yml | 10 ++++------ .github/workflows/autoblack.yml | 9 +-------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/auto_messages_pot.yml b/.github/workflows/auto_messages_pot.yml index c290b6f..18e5c00 100644 --- a/.github/workflows/auto_messages_pot.yml +++ b/.github/workflows/auto_messages_pot.yml @@ -14,25 +14,23 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.11 + - name: Install dependencies run: | cd tools/readme_generator/ pip install -r requirements.txt + - name: Save old messges.pot for diffing later run: | cd tools/readme_generator/ cp messages.pot messages.pot.old + - name: Try to generate messages.pot run: | cd tools/readme_generator/ pybabel extract --ignore-dirs venv -F babel.cfg -o messages.pot . - - shell: pwsh - id: check_files_changed - run: | - $HasDiff = python .github/diff_pot_files.py tools/readme_generator/messages.pot.old tools/readme_generator/messages.pot - Write-Host "::set-output name=files_changed::$HasDiff" + - name: Create Pull Request - if: steps.check_files_changed.outputs.files_changed == 'true' uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/autoblack.yml b/.github/workflows/autoblack.yml index 761222b..25c8e8b 100644 --- a/.github/workflows/autoblack.yml +++ b/.github/workflows/autoblack.yml @@ -15,15 +15,8 @@ jobs: with: options: "." continue-on-error: true - - shell: pwsh - id: check_files_changed - run: | - # Diff HEAD with the previous commit - $diff = git diff - $HasDiff = $diff.Length -gt 0 - Write-Host "::set-output name=files_changed::$HasDiff" + - name: Create Pull Request - if: steps.check_files_changed.outputs.files_changed == 'true' uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }}