From 19423b0c0a39cb1680be74e6a80d0066e1f15b71 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Wed, 21 Feb 2024 18:26:06 +0100 Subject: [PATCH] ci: Only run PR workflows when files have changed --- .github/workflows/build.yaml | 17 +++++++++++++++++ .github/workflows/ci.yaml | 7 ------- .github/workflows/docs.yaml | 11 +++++++++++ .github/workflows/test.yaml | 15 +++++++++++++++ 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e75516c08..25f3be920 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -5,6 +5,23 @@ on: secrets: CACHIX_AUTH_TOKEN: required: false + pull_request: + branches: + - main + - v[0-9]+ + paths: + - .github/workflows/build.yaml + - .github/actions/setup-nix/** + - .github/scripts/** + - .github/* + - '*.nix' + - nix/** + - .cirrus.yml + - cabal.project* + - postgrest.cabal + - stack.yaml* + - '**.hs' + - '!**.md' concurrency: # Terminate all previous runs of the same workflow for pull requests diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f11d5deb1..4417049ea 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,10 +7,6 @@ on: - v[0-9]+ tags: - v* - pull_request: - branches: - - main - - v[0-9]+ concurrency: # Terminate all previous runs of the same workflow for pull requests @@ -20,13 +16,11 @@ concurrency: jobs: docs: name: Docs - if: github.event_name == 'push' uses: ./.github/workflows/docs.yaml test: name: Test - if: github.event_name == 'push' uses: ./.github/workflows/test.yaml secrets: CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} @@ -41,7 +35,6 @@ jobs: Build-Cabal-Arm: name: Build aarch64 (Cabal, GHC 9.4.8) - if: github.event_name == 'push' runs-on: ubuntu-latest outputs: remotepath: ${{ steps.Remote-Dir.outputs.remotepath }} diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 0b3df8c40..f5a23825b 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -2,6 +2,17 @@ name: Docs on: workflow_call: + pull_request: + branches: + - main + - v[0-9]+ + paths: + - .github/workflows/docs.yaml + - .github/actions/setup-nix/** + - default.nix + - nix/** + - docs/** + - '!**.md' concurrency: # Terminate all previous runs of the same workflow for pull requests diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4dde2ac00..547a2cba8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,6 +5,21 @@ on: secrets: CACHIX_AUTH_TOKEN: required: false + pull_request: + branches: + - main + - v[0-9]+ + paths: + - .github/workflows/test.yaml + - .github/actions/setup-nix/** + - default.nix + - nix/** + - .stylish-haskell.yaml + - cabal.project + - postgrest.cabal + - '**.hs' + - test/** + - '!**.md' concurrency: # Terminate all previous runs of the same workflow for pull requests