Only run flake8 annotation if there are *.py files in diff

This commit is contained in:
Athanasius committed 2020-07-28 16:02:38 +01:00
1 parent 8337e41d75
commit 771ea531ee
1 file changed
+35 -11
+35 -11
View File
@@ -11,19 +11,43 @@ on:
branches: [ develop ]
jobs:
build:
check_py:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Annotate with Flake8
uses: "tayfun/flake8-your-pr@master"
- name: Check for PY files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_REF: ${{github.base_ref}}
run: |
# Will exit with non-zero if no filenames ending in ".py" are in
# the diff.
git diff --name-only "refs/remotes/origin/${BASE_REF}" -- | egrep -v '.py$'
flake8_annotate:
- name: Annotate PR with Flake8
needs: check_py
# Only run if the check_py succeeded
if: ${{ success() }}
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Annotate with Flake8
uses: "tayfun/flake8-your-pr@master"
needs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}