Files
EDMarketConnector/.github/workflows/pr-annotate-with-flake8.yml
T
Athanasius 12b100fd39 Gurantee exit 0 AND fix the echo
* GH Workflows run under "/bin/bash -e", which means if anything in it
 fails it all exits immediately.  So append " || true" to the egrep.
* The echo to magically set the env var back in the workflow needs to
 use "" not '' else the in-shell variable won't interpolate.
2020-07-28 16:42:57 +01:00

43 lines
1.1 KiB
YAML

# This workflow will:
#
# install Python dependencies
# Run flake8 to add annotations to the PR
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: PR-annotate-flake8
on:
pull_request:
branches: [ develop ]
jobs:
flake8_annotate:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check for PY files
env:
BASE_REF: ${{github.base_ref}}
run: |
# Will exit with non-zero if no filenames ending in ".py" are in
# the diff.
PYFILES=$(git diff --name-only "refs/remotes/origin/${BASE_REF}" -- | egrep '.py$' || true)
echo "::set-env name=PYFILES::${PYFILES}"
- name: Set up Python 3.7
if: ${{ env.PYFILES != '' }}
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Annotate with Flake8
if: ${{ env.PYFILES != '' }}
uses: "tayfun/flake8-your-pr@master"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}