From cea7d14214a99ee29c22072be6822e50ef39bcb5 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 28 Jul 2020 17:37:57 +0100 Subject: [PATCH] Check for .git in PY files check. NB: This might cause env.PYFILES checks to fail if they need the var to at least exist. --- .github/workflows/pr-annotate-with-flake8.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-annotate-with-flake8.yml b/.github/workflows/pr-annotate-with-flake8.yml index 9bb28cbf..779b61ba 100644 --- a/.github/workflows/pr-annotate-with-flake8.yml +++ b/.github/workflows/pr-annotate-with-flake8.yml @@ -25,8 +25,11 @@ jobs: env: BASE_REF: ${{github.base_ref}} run: | - # Will exit with non-zero if no filenames ending in ".py" are in - # the diff. + # 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}"