From a93cfb5ed8bf73ba3e5afb7629f55511d884a0ba Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 28 Jul 2020 16:25:27 +0100 Subject: [PATCH] Try ENV var for passing presence of *.py files This uses to set PYFILES env var globally in the job, so should be testable in the following steps. --- .github/workflows/pr-annotate-with-flake8.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-annotate-with-flake8.yml b/.github/workflows/pr-annotate-with-flake8.yml index 05d914cb..32bbdf5b 100644 --- a/.github/workflows/pr-annotate-with-flake8.yml +++ b/.github/workflows/pr-annotate-with-flake8.yml @@ -26,16 +26,17 @@ jobs: run: | # Will exit with non-zero if no filenames ending in ".py" are in # the diff. - git diff --name-only "refs/remotes/origin/${BASE_REF}" -- | egrep '.py$' + PYFILES=$(git diff --name-only "refs/remotes/origin/${BASE_REF}" -- | egrep '.py$') + echo '::set-env name=PYFILES::${PYFILES}' - name: Set up Python 3.7 - if: ${{ success() }} + if: ${{ env.PYFILES != "" }} uses: actions/setup-python@v2 with: python-version: 3.7 - name: Annotate with Flake8 - if: ${{ success() }} + if: ${{ env.PYFILES != "" }} uses: "tayfun/flake8-your-pr@master" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}