From 9be8d738033ada07d44a70eabf2fbbcc56974576 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/added_dates.yml | 1 + .github/workflows/auto_messages_pot.yml | 10 ++++------ .github/workflows/autoblack.yml | 9 +-------- .github/workflows/test_toml.yaml | 11 ++--------- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/.github/workflows/added_dates.yml b/.github/workflows/added_dates.yml index 6a32fd44..397a7a5b 100644 --- a/.github/workflows/added_dates.yml +++ b/.github/workflows/added_dates.yml @@ -13,6 +13,7 @@ jobs: with: fetch-depth: 0 token: ${{ secrets.YUNOHOST_BOT_TOKEN }} + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: diff --git a/.github/workflows/auto_messages_pot.yml b/.github/workflows/auto_messages_pot.yml index c290b6f8..18e5c000 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 761222be..25c8e8b3 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 }} diff --git a/.github/workflows/test_toml.yaml b/.github/workflows/test_toml.yaml index 8cd0e4b4..6c67ec9f 100644 --- a/.github/workflows/test_toml.yaml +++ b/.github/workflows/test_toml.yaml @@ -11,15 +11,8 @@ jobs: - uses: actions/checkout@v4 - uses: uncenter/setup-taplo@v1 - run: taplo fmt - - 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 }} @@ -28,4 +21,4 @@ jobs: body: | This pull request uses the [Taplo](https://taplo.tamasfe.dev) formatter. base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch - branch: actions/toml \ No newline at end of file + branch: actions/toml