1
0
Fork 0

Simplify github workflow: peter-evans/create-pull-request@v6 already checks if diff exists

This commit is contained in:
Félix Piédallu 2024-06-02 21:04:21 +02:00 committed by Salamandar
parent 01330c5d7c
commit 33af9b876f
2 changed files with 5 additions and 14 deletions

View file

@ -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 }}

View file

@ -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 }}