1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-05-25 11:27:39 +03:00
EDMarketConnector/.github/workflows/pr-annotate-with-flake8.yml
2020-07-29 15:00:39 +01:00

47 lines
1.4 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
if: ${{ github.actor == 'Athanasius' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check for PY files
env:
BASE_REF: ${{github.base_ref}}
run: |
# Checkout might not have happened.
if [ ! -d ".git" ]; then exit 0 ; fi
# Get a list of files ending with ".py", stuff in environment.
# We don't rely on exit status because Workflows run with
# "set -e" so any failure in a pipe is total failure.
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 }}