Simplify github workflow: peter-evans/create-pull-request@v6 already checks if diff exists
This commit is contained in:
parent
01330c5d7c
commit
33af9b876f
2 changed files with 5 additions and 14 deletions
10
.github/workflows/auto_messages_pot.yml
vendored
10
.github/workflows/auto_messages_pot.yml
vendored
|
@ -14,25 +14,23 @@ jobs:
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.11
|
python-version: 3.11
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd tools/readme_generator/
|
cd tools/readme_generator/
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
- name: Save old messges.pot for diffing later
|
- name: Save old messges.pot for diffing later
|
||||||
run: |
|
run: |
|
||||||
cd tools/readme_generator/
|
cd tools/readme_generator/
|
||||||
cp messages.pot messages.pot.old
|
cp messages.pot messages.pot.old
|
||||||
|
|
||||||
- name: Try to generate messages.pot
|
- name: Try to generate messages.pot
|
||||||
run: |
|
run: |
|
||||||
cd tools/readme_generator/
|
cd tools/readme_generator/
|
||||||
pybabel extract --ignore-dirs venv -F babel.cfg -o messages.pot .
|
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
|
- name: Create Pull Request
|
||||||
if: steps.check_files_changed.outputs.files_changed == 'true'
|
|
||||||
uses: peter-evans/create-pull-request@v6
|
uses: peter-evans/create-pull-request@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
9
.github/workflows/autoblack.yml
vendored
9
.github/workflows/autoblack.yml
vendored
|
@ -15,15 +15,8 @@ jobs:
|
||||||
with:
|
with:
|
||||||
options: "."
|
options: "."
|
||||||
continue-on-error: true
|
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
|
- name: Create Pull Request
|
||||||
if: steps.check_files_changed.outputs.files_changed == 'true'
|
|
||||||
uses: peter-evans/create-pull-request@v6
|
uses: peter-evans/create-pull-request@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
Loading…
Reference in a new issue