From 6d7b736634c1c1fb7b4e3fb7a37ed4a3db6f312a Mon Sep 17 00:00:00 2001 From: Peter Law Date: Sat, 19 Nov 2022 10:15:10 +0000 Subject: [PATCH] Only run the Docker build when relevant changes are made The Docker build is comparatively slow (1-2 minutes) and mostly redundant given that the majority of PRs change docs content rather than configuration or build system. --- .github/workflows/validate.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b787c6d9..8a36002f 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -28,7 +28,31 @@ jobs: - name: Build & Validate run: rake validate + changes: + runs-on: ubuntu-latest + if: github.ref != 'refs/heads/master' + permissions: + pull-requests: read + outputs: + docker: ${{ steps.filter.outputs.docker }} + steps: + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + docker: + - '_config.yml' + - '.dockerignore' + - '*docker*' + - 'Dockerfile' + - 'Gemfile*' + - 'package*.json' + - 'Rakefile' + - '.github/workflows/validate.yml' + docker: + needs: changes + if: needs.changes.outputs.docker == 'true' || github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2