From 9d99bcc7ef861aa5fe83d5dd30e5d4764d253f70 Mon Sep 17 00:00:00 2001 From: "Jakub A. W." Date: Tue, 24 Nov 2026 12:31:29 +0100 Subject: [PATCH 1/3] ci: skip jobs a change cannot affect and pin Scorecard to v2.5.0 --- .github/dependabot.yml | 4 ++ .github/workflows/codeql.yml | 6 +++ .github/workflows/docs.yml | 46 +++++++++++++++++ .github/workflows/scorecard.yml | 4 +- .github/workflows/test.yml | 92 ++++++++++++++++----------------- 5 files changed, 105 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/docs.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c6292adae..de84fc91c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -80,6 +80,10 @@ updates: default-days: 3 labels: - "dependencies" + ignore: + # v2.6.0's image cannot be pulled from ghcr.io; see scorecard.yml. + - dependency-name: "ossf/scorecard-action" + versions: ["2.6.0"] groups: github-actions: patterns: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 4d5de66e7..ef9195d0b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -3,8 +3,14 @@ name: CodeQL on: push: branches: [main] + paths-ignore: + - "docs/**" + - "**/*.md" pull_request: branches: [main] + paths-ignore: + - "docs/**" + - "**/*.md" schedule: - cron: "31 3 * * 1" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..644a471bd --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,46 @@ +name: Docs + +on: + push: + branches: [main] + paths: + - "docs/**" + - ".github/workflows/docs.yml" + pull_request: + branches: [main] + paths: + - "docs/**" + - ".github/workflows/docs.yml" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + docs-validate: + name: Docs Validation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + + # To avoid possible issues related to missing libsecret binary on the runner + - name: Install system dependencies + run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev + + - name: Setup Node.js + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 + with: + node-version: '22' + + # Pinned: a bare `npx mint` installs the release published last, and a + # mint release reaches npm a few minutes before the @mintlify/cli version + # it depends on, so a run in that window fails with ETARGET. Dependabot + # does not see this pin; bump it by hand. + - name: Validate docs.json + run: npx mint@4.3.37 validate + working-directory: docs diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 782232172..fbf009abe 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -28,7 +28,9 @@ jobs: persist-credentials: false - name: Run analysis - uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0 + # v2.6.0's image index points at an amd64 manifest missing from ghcr.io, + # so the pull fails; stay on v2.5.0 until a fixed release ships. + uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 with: results_file: results.sarif results_format: sarif diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a028f0cc9..74800e2e8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,20 @@ name: CI +# Changes that touch only docs/, helm/ or Markdown files skip this workflow: +# docs.yml and helm.yml check those. on: push: branches: [main] + paths-ignore: + - "docs/**" + - "helm/**" + - "**/*.md" pull_request: branches: [main] + paths-ignore: + - "docs/**" + - "helm/**" + - "**/*.md" # Cancel redundant runs on the same branch concurrency: @@ -25,6 +35,37 @@ permissions: contents: read jobs: + # A pull request that changes only Go tests (*_test.go, tests/, testdata/) + # leaves the binary and its dependency graph untouched, so it skips the + # Dashboard, Build and Vulnerability Scan jobs. Pushes to main run them all. + changes: + name: Detect changes + runs-on: ubuntu-latest + outputs: + source: ${{ steps.diff.outputs.source }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + # The pull request merge commit's first parent is the base branch, + # so a depth of 2 is enough to diff against it. + fetch-depth: 2 + + - name: Check for non-test changes + id: diff + run: | + if [ "${{ github.event_name }}" != "pull_request" ]; then + echo "source=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + changed=$(git diff --name-only HEAD^1 HEAD) + if grep -qvE '(_test\.go$|^tests/|/testdata/)' <<< "$changed"; then + echo "source=true" >> "$GITHUB_OUTPUT" + else + echo "source=false" >> "$GITHUB_OUTPUT" + echo "Only Go test files changed; skipping Dashboard, Build and Vulnerability Scan." + fi + lint: name: lint runs-on: ubuntu-latest @@ -70,6 +111,8 @@ jobs: # sources and package-lock.json only. See docs/adr/0010-dashboard-built-in-ci.md. frontend: name: Dashboard + needs: changes + if: needs.changes.outputs.source == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 @@ -263,6 +306,8 @@ jobs: vulncheck: name: Vulnerability Scan + needs: changes + if: needs.changes.outputs.source == 'true' runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -287,58 +332,13 @@ jobs: govulncheck ./... govulncheck -tags=swagger ./... - # Only runs when the pull request touches docs/. Pushes to main always run - # it. The check needs a full Node toolchain (libsecret, mint) that costs - # more than the validation itself. - docs-validate: - name: Docs Validation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - with: - persist-credentials: false - # The pull request merge commit's first parent is the base branch, - # so a depth of 2 is enough to diff against it. - fetch-depth: 2 - - - name: Check for docs changes - id: changes - run: | - if [ "${{ github.event_name }}" != "pull_request" ]; then - echo "docs=true" >> "$GITHUB_OUTPUT" - elif git diff --name-only HEAD^1 HEAD -- docs/ | grep -q .; then - echo "docs=true" >> "$GITHUB_OUTPUT" - else - echo "docs=false" >> "$GITHUB_OUTPUT" - echo "No docs/ changes; skipping validation." - fi - - # To avoid possible issues related to missing libsecret binary on the runner runner - - name: Install system dependencies - if: steps.changes.outputs.docs == 'true' - run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev - - - name: Setup Node.js - if: steps.changes.outputs.docs == 'true' - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 - with: - node-version: '22' - - # Pinned: a bare `npx mint` installs the release published last, and a - # mint release reaches npm a few minutes before the @mintlify/cli version - # it depends on, so a run in that window fails with ETARGET. Dependabot - # does not see this pin; bump it by hand. - - name: Validate docs.json - if: steps.changes.outputs.docs == 'true' - run: npx mint@4.3.37 validate - working-directory: docs - # Compiling the binary doesn't depend on tests passing, so this runs in # parallel with the test jobs rather than gating behind them. It is the one # Go job that embeds the real dashboard bundle. build: name: Build runs-on: ubuntu-latest + # Skipped with the Dashboard job when only Go tests changed. needs: frontend steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 From e21a787a728428d284b8085d0256302f7e16773b Mon Sep 17 00:00:00 2001 From: "Jakub A. W." Date: Tue, 24 Nov 2026 12:49:03 +0100 Subject: [PATCH 2/3] ci: keep example plugins and main CodeQL baselines covered --- .github/workflows/codeql.yml | 8 ++++---- .github/workflows/test.yml | 32 ++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ef9195d0b..31c8b8e9e 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,16 +1,16 @@ name: CodeQL +# Pull requests that change only prose skip the scan. Pushes to main are never +# filtered: code scanning compares a pull request with the analysis of its base +# commit, and a skipped push leaves that commit without one. on: push: branches: [main] - paths-ignore: - - "docs/**" - - "**/*.md" pull_request: branches: [main] paths-ignore: - - "docs/**" - "**/*.md" + - "**/*.mdx" schedule: - cron: "31 3 * * 1" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 74800e2e8..50ad46efe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,20 +1,26 @@ name: CI -# Changes that touch only docs/, helm/ or Markdown files skip this workflow: -# docs.yml and helm.yml check those. +# Changes that touch only docs/, helm/ or Markdown files skip this workflow. +# docs.yml validates docs/ and helm.yml the chart; other Markdown has no check. +# docs/example_plugins stays in: it is Go code the e2e suite builds and loads. +# Later patterns win, so the order matters. on: push: branches: [main] - paths-ignore: - - "docs/**" - - "helm/**" - - "**/*.md" + paths: + - "**" + - "!docs/**" + - "docs/example_plugins/**" + - "!helm/**" + - "!**/*.md" pull_request: branches: [main] - paths-ignore: - - "docs/**" - - "helm/**" - - "**/*.md" + paths: + - "**" + - "!docs/**" + - "docs/example_plugins/**" + - "!helm/**" + - "!**/*.md" # Cancel redundant runs on the same branch concurrency: @@ -58,8 +64,10 @@ jobs: echo "source=true" >> "$GITHUB_OUTPUT" exit 0 fi - changed=$(git diff --name-only HEAD^1 HEAD) - if grep -qvE '(_test\.go$|^tests/|/testdata/)' <<< "$changed"; then + # --no-renames lists both sides of a rename, so moving a source file + # into a test path still counts as a source change. + changed=$(git diff --name-only --no-renames HEAD^1 HEAD) + if grep -qvE '(_test\.go$|^tests/|(^|/)testdata/)' <<< "$changed"; then echo "source=true" >> "$GITHUB_OUTPUT" else echo "source=false" >> "$GITHUB_OUTPUT" From 2bdf067b118f631183196fa2f8bc39d60edadecf Mon Sep 17 00:00:00 2001 From: "Jakub A. W." Date: Tue, 24 Nov 2026 15:57:29 +0100 Subject: [PATCH 3/3] ci: skip CodeQL on pull requests that change only non-code docs files --- .github/workflows/codeql.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 31c8b8e9e..798e5d485 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,16 +1,21 @@ name: CodeQL -# Pull requests that change only prose skip the scan. Pushes to main are never -# filtered: code scanning compares a pull request with the analysis of its base -# commit, and a skipped push leaves that commit without one. +# Pull requests that change only docs/ or Markdown skip the scan; the Go and +# JavaScript examples under docs/ stay in (later patterns win). Pushes to main +# are never filtered: code scanning compares a pull request with the analysis +# of its base commit, and a skipped push leaves that commit without one. on: push: branches: [main] pull_request: branches: [main] - paths-ignore: - - "**/*.md" - - "**/*.mdx" + paths: + - "**" + - "!docs/**" + - "docs/example_plugins/**" + - "docs/examples/**" + - "!**/*.md" + - "!**/*.mdx" schedule: - cron: "31 3 * * 1"