From 7e0f5ac7d8f937ac762ca49cf3ff165db54e54c0 Mon Sep 17 00:00:00 2001 From: jeanluc Date: Fri, 18 Oct 2024 13:59:52 +0200 Subject: [PATCH] Run only necessary jobs in PR CI --- .github/workflows/ci.yml | 4 ++++ .github/workflows/get-changed-files.yml | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6cfb9d..c528b89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,12 +34,16 @@ jobs: name: Tests needs: - pre-commit + - get-changed-files + if: github.event_name != 'pull_request' || fromJSON(needs.get-changed-files.outputs.changed-files)['needs_tests'] == 'true' uses: ./.github/workflows/test-action.yml docs: name: Docs needs: - pre-commit + - get-changed-files + if: github.event_name != 'pull_request' || fromJSON(needs.get-changed-files.outputs.changed-files)['docs'] == 'true' uses: ./.github/workflows/docs-action.yml deploy-docs: diff --git a/.github/workflows/get-changed-files.yml b/.github/workflows/get-changed-files.yml index 011a44c..f641bd9 100644 --- a/.github/workflows/get-changed-files.yml +++ b/.github/workflows/get-changed-files.yml @@ -34,6 +34,21 @@ jobs: - .pre-commit-config.y?(a)ml - .pylintrc - pyproject.toml + docs: + - added|modified|deleted: + - .github/** + - docs/** + - noxfile.py + - CHANGELOG.rst + - README.rst + - pyproject.toml + needs_tests: + - added|modified|deleted: + - .github/** + - src/** + - tests/** + - noxfile.py + - pyproject.toml - name: Echo Changed Files Output run: echo "${{ toJSON(steps.changed-files.outputs) }}"