From 12b100fd393559dbc2b47fdac93aaa23a51ee318 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 28 Jul 2020 16:42:57 +0100 Subject: [PATCH] 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. --- .github/workflows/pr-annotate-with-flake8.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-annotate-with-flake8.yml b/.github/workflows/pr-annotate-with-flake8.yml index 41728432..0783eecd 100644 --- a/.github/workflows/pr-annotate-with-flake8.yml +++ b/.github/workflows/pr-annotate-with-flake8.yml @@ -26,9 +26,8 @@ jobs: 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$') - echo '::set-env name=PYFILES::${PYFILES}' - exit 0 + 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 != '' }}