From 9ee42529e215fc7bd72a97f74b9f4af2316f0075 Mon Sep 17 00:00:00 2001 From: Abigail G Date: Thu, 13 May 2021 20:09:07 -0400 Subject: [PATCH] update linting workflow to not run multiple times unnecessarily --- .github/workflows/linting.yml | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 4e451e1..b92eac4 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -3,19 +3,42 @@ name: Linting on: [push,pull_request] jobs: - flake8_py3: - runs-on: ubuntu-latest + precheck: + runs-on: ubuntu-20.04 + + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + # skip concurrent jobs if they are on the same thing + concurrent_skipping: 'same_content' + # never skip PR + manual/scheduled runs + do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' + + flake8: + needs: precheck + if: ${{ needs.precheck.outputs.should_skip != 'true' }} + runs-on: ubuntu-20.04 + + strategy: + matrix: + python-version: [3.9] + steps: - uses: actions/checkout@master - - uses: actions/setup-python@v1 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 with: - python-version: 3.9 + python-version: ${{ matrix.python-version }} architecture: x64 - name: Install flake8 run: pip install flake8 - name: Run flake8 uses: suo/flake8-github-action@releases/v1 with: - checkName: 'flake8_py3' # NOTE: this needs to be the same as the job name + checkName: 'flake8' # NOTE: this needs to be the same as the job name env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +