# 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: set_allowed: runs-on: ubuntu-18.04 outputs: matrix: ${{ steps.set-allowed.outputs.allowed }} steps: - id: set-allowed run: echo '::set-output name=allowed::{["Athanasius"]}' flake8_annotate: runs-on: ubuntu-18.04 needs: set_allowed steps: - name: Checkout if: ${{ contains(fromJson(needs.set_allowed.outputs.allowed), github.actor) }} 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 [ ! -f ".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 }}