diff --git a/.github/workflows/build-images.yaml b/.github/workflows/build-images.yaml index e8ed4951a..3c44c713d 100644 --- a/.github/workflows/build-images.yaml +++ b/.github/workflows/build-images.yaml @@ -20,7 +20,33 @@ concurrency: permissions: {} jobs: + # Docs-only changes (docs/, markdown, rst) can't affect the built image, so building/pushing one + # is redundant. Detected once here so the job below can skip entirely on them. + changes: + runs-on: ubuntu-latest + outputs: + code: ${{ steps.filter.outputs.code }} + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Check for non-doc changes + id: filter + uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + with: + predicate-quantifier: 'some-with-excludes' + filters: | + code: + - '**' + - '!docs/**' + - '!**/*.md' + - '!**/*.rst' + docker: + needs: changes + if: needs.changes.outputs.code == 'true' runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9564bb36c..ef40efa7a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -26,8 +26,34 @@ on: permissions: {} jobs: + # Docs-only changes (docs/, markdown, rst) can't affect Go code, so CodeQL has nothing new to + # find. Detected once here so the job below can skip entirely on them. + changes: + runs-on: ubuntu-latest + outputs: + code: ${{ steps.filter.outputs.code }} + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Check for non-doc changes + id: filter + uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + with: + predicate-quantifier: 'some-with-excludes' + filters: | + code: + - '**' + - '!docs/**' + - '!**/*.md' + - '!**/*.rst' + analyze: name: Analyze + needs: changes + if: needs.changes.outputs.code == 'true' runs-on: ubuntu-latest permissions: actions: read diff --git a/.github/workflows/govulncheck.yaml b/.github/workflows/govulncheck.yaml index 38415cb65..51b1f56bf 100644 --- a/.github/workflows/govulncheck.yaml +++ b/.github/workflows/govulncheck.yaml @@ -14,7 +14,33 @@ on: permissions: {} jobs: + # Docs-only changes (docs/, markdown, rst) can't affect Go code, so govulncheck has nothing new + # to find. Detected once here so the job below can skip entirely on them. + changes: + runs-on: ubuntu-latest + outputs: + code: ${{ steps.filter.outputs.code }} + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Check for non-doc changes + id: filter + uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + with: + predicate-quantifier: 'some-with-excludes' + filters: | + code: + - '**' + - '!docs/**' + - '!**/*.md' + - '!**/*.rst' + govulncheck_job: + needs: changes + if: needs.changes.outputs.code == 'true' runs-on: ubuntu-latest name: Run govulncheck permissions: @@ -24,4 +50,4 @@ jobs: uses: golang/govulncheck-action@032d45514ae346b1db93c04b0c90b841c370344f # v1 with: go-version-input: 'stable' - go-package: ./... \ No newline at end of file + go-package: ./...