Skip to content

Commit ccf01cd

Browse files
feat(governance): add codeql-reusable.yml — consolidate 263-repo codeql.yml drift (#192)
## Summary Third foundational reusable in the workflow-convergence sweep (#168#174#187#190 → this). Targets `codeql.yml`, the 263-deployment CodeQL security-analysis workflow. ### Drift survey Full pagination of `gh api /search/code` against `org:hyperpolymath`, blob-SHA grouped: | Metric | Value | |---|---| | Total deployments | **263** | | Unique blob SHAs | **69** (26% drift — same as mirror.yml) | | Top 7 SHAs coverage | **195/263 (74%)** | | Long-tail SHAs | 62 SHAs / 68 repos | ### Language matrix distribution (key for design) | Languages | Repos | Share | |---|---|---| | `javascript-typescript` only | **223** | **84.8%** | | `actions` only | 22 | 8.4% | | NONE (no matrix declared) | 6 | 2.3% | | `rust` only | 3 | 1.1% | | `javascript-typescript,rust` | 3 | 1.1% | | `actions,javascript-typescript` | 3 | 1.1% | | `actions,javascript-typescript,rust` | 2 | 0.8% | | `actions,rust` | 1 | 0.4% | **100% of estate variants use `build-mode: none`** — verified across rust-only, actions-only, and mixed sampled variants. ### Design choice — single-language single-job reusable Caller invokes the reusable **once per language**. Multi-language wrappers (~3.4%) call it multiple times in parallel; per-language SARIF separation is preserved via the `category: "/language:${{ inputs.language }}"` step. This matches how callers already think about CodeQL (one job per language) without forcing a JSON-array input or matrix-as-string-input. The alternative (matrix-as-input) would have made the 85% single-language case more awkward. ### Inputs - `language` (string, default `javascript-typescript`) — single CodeQL language identifier - `build-mode` (string, default `none`) — 100% of estate currently uses `none`; default covers everything - `runs-on` (string, default `ubuntu-latest`) ### Caller wrapper examples **Single-language (~85% of estate):** ```yaml jobs: codeql: uses: hyperpolymath/standards/.github/workflows/codeql-reusable.yml@<sha> ``` ~5 lines, replacing ~49. **Rust-only or actions-only (~10% of estate):** ```yaml jobs: codeql: uses: hyperpolymath/standards/.github/workflows/codeql-reusable.yml@<sha> with: language: rust ``` **Multi-language (~3.4% of estate):** ```yaml jobs: codeql-js: uses: hyperpolymath/standards/.github/workflows/codeql-reusable.yml@<sha> codeql-actions: uses: hyperpolymath/standards/.github/workflows/codeql-reusable.yml@<sha> with: language: actions codeql-rust: uses: hyperpolymath/standards/.github/workflows/codeql-reusable.yml@<sha> with: language: rust ``` ### Rollout plan **NOT started in this PR — owner-gated.** | Wave | Repos | Action | |---|---|---| | 1: bulk-mechanical | ~210 | Single-language `javascript-typescript` default. One-line wrapper. | | 2: single non-default | ~25 | Override `language: rust` or `language: actions`. | | 3: multi-language | ~9 | Two or three reusable invocations per wrapper. | | 4: NEEDS_REVIEW | ~18 | `NONE` matrix (6) + 100-line custom workflows (~2-3). Per-repo review. | Total expected sweep: ~245 PRs (93% mechanical). ### Pattern hardening - Same `workflow_call` shape as #168 / #174 / #187 / #190 — no new infrastructure. - Independent of all open standards PRs — lands in any order. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 6a519a2 commit ccf01cd

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# codeql-reusable.yml — Reusable CodeQL security-analysis workflow.
3+
#
4+
# Consolidates the per-repo `codeql.yml` workflow (estate-wide: 263
5+
# deployments, 69 unique blob SHAs, 26% structural drift). Language
6+
# matrix distribution across the estate:
7+
#
8+
# javascript-typescript 223 (84.8%)
9+
# actions 22 (8.4%)
10+
# NONE (no matrix declared) 6 (2.3%)
11+
# rust 3 (1.1%)
12+
# javascript-typescript,rust 3 (1.1%)
13+
# actions,javascript-typescript 3 (1.1%)
14+
# actions,javascript-typescript,rust 2 (0.8%)
15+
# actions,rust 1 (0.4%)
16+
#
17+
# 100% of estate variants currently use `build-mode: none`.
18+
#
19+
# Design: single-language single-job reusable. Multi-language wrappers
20+
# invoke the reusable once per language (parallel-by-construction).
21+
# This avoids the matrix-as-input awkwardness while preserving per-
22+
# language SARIF separation via the `category` step.
23+
#
24+
# Caller examples:
25+
#
26+
# # Single-language (~85% of estate):
27+
# jobs:
28+
# codeql:
29+
# uses: hyperpolymath/standards/.github/workflows/codeql-reusable.yml@<sha>
30+
# # defaults to language=javascript-typescript, build-mode=none
31+
#
32+
# # Rust-only:
33+
# jobs:
34+
# codeql:
35+
# uses: hyperpolymath/standards/.github/workflows/codeql-reusable.yml@<sha>
36+
# with:
37+
# language: rust
38+
#
39+
# # Multi-language (JS/TS + actions + Rust):
40+
# jobs:
41+
# codeql-js:
42+
# uses: hyperpolymath/standards/.github/workflows/codeql-reusable.yml@<sha>
43+
# codeql-actions:
44+
# uses: hyperpolymath/standards/.github/workflows/codeql-reusable.yml@<sha>
45+
# with:
46+
# language: actions
47+
# codeql-rust:
48+
# uses: hyperpolymath/standards/.github/workflows/codeql-reusable.yml@<sha>
49+
# with:
50+
# language: rust
51+
52+
name: CodeQL Security Analysis (reusable)
53+
54+
on:
55+
workflow_call:
56+
inputs:
57+
language:
58+
description: 'CodeQL language identifier (e.g. javascript-typescript, rust, actions). Single language per call; multi-language wrappers invoke the reusable once per language.'
59+
type: string
60+
required: false
61+
default: javascript-typescript
62+
build-mode:
63+
description: 'CodeQL build mode (none|autobuild|manual). 100% of estate currently uses "none"; override only for compiled languages that require explicit build.'
64+
type: string
65+
required: false
66+
default: none
67+
runs-on:
68+
description: 'Runner label for the analyze job'
69+
type: string
70+
required: false
71+
default: ubuntu-latest
72+
73+
permissions:
74+
contents: read
75+
76+
jobs:
77+
analyze:
78+
runs-on: ${{ inputs.runs-on }}
79+
permissions:
80+
contents: read
81+
security-events: write
82+
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
86+
87+
- name: Initialize CodeQL
88+
uses: github/codeql-action/init@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v3
89+
with:
90+
languages: ${{ inputs.language }}
91+
build-mode: ${{ inputs.build-mode }}
92+
93+
- name: Perform CodeQL Analysis
94+
uses: github/codeql-action/analyze@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v3
95+
with:
96+
category: "/language:${{ inputs.language }}"

0 commit comments

Comments
 (0)