diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b9a99ef..be58190 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -19,22 +19,35 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Check if python changes are present + id: check + env: + GITHUB_REPO: ${{ github.repository }} + PR_NUMBER: ${{ github.event.pull_request.number }} + continue-on-error: true + run: ./scripts/ci_skip_python.sh - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 + if: steps.check.outcome == 'failure' with: python-version: ${{ matrix.python-version }} - name: Install dependencies + if: steps.check.outcome == 'failure' run: | python -m pip install -r requirements.txt - name: Lint with black + if: steps.check.outcome == 'failure' run: | black --check --target-version py38 setup.py pyhtzee tests - name: Lint with flake8 + if: steps.check.outcome == 'failure' run: | flake8 . --count --show-source --statistics - name: Lint with mypy + if: steps.check.outcome == 'failure' run: | mypy --ignore-missing-imports . - name: Test with pytest + if: steps.check.outcome == 'failure' run: | pytest tests/*.py diff --git a/scripts/ci_skip_python.sh b/scripts/ci_skip_python.sh new file mode 100755 index 0000000..97c4ab7 --- /dev/null +++ b/scripts/ci_skip_python.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +URL="https://api.github.com/repos/${GITHUB_REPO}/pulls/${PR_NUMBER}/files" +FILES=$(curl -s -X GET -G $URL | jq -r '.[] | .filename') + +cat<