build(ci): decide "does this need a build" in one reusable workflow - #1965
Merged
Merged
Conversation
CLAUDE.md, AGENTS.md, SECURITY.md and THREAT_MODEL.md feed nothing in the build, packaging or runtime, yet every edit to them ran the full matrix plus Sonar, CodeQL and OWASP. Adding them beside .claude/ in each workflow's paths-ignore would have meant five copies of one list that must stay identical, plus a sixth in the maven.yml `changes` job that keeps the required "Build and Test" check reporting. Path filters under `on:` cannot be shared, so the decision moves out of the triggers into a reusable workflow, changes.yml, that owns the list and outputs `code`. It lists the changed files from the pull-request files API or, on push, the compare API, and builds for any other event or whenever the list cannot be fetched. The four workflows call it and gate on its output; maven.yml keeps gating at step level for the required check. Patterns are anchored to the repository root. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
lukaszlenart
force-pushed
the
build/ci-skip-process-docs
branch
from
September 18, 2026 04:41
0d7498d to
ed08a6c
Compare
lukaszlenart
marked this pull request as ready for review
September 18, 2026 04:45
Sonar S8233 flags workflow-level write permissions. The analyze job already carries its own permissions block, which replaces the workflow-level one, so the workflow-level security-events and id-token writes never reached it. Keep contents: read at workflow level and the security-events write on the job that uploads. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Jenkinsfile keeps its own copy of the filter because Jenkins cannot call a GitHub reusable workflow. Extend it to the root process docs with the same anchored pattern, and cross-reference the two copies. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
CLAUDE.md,AGENTS.md,SECURITY.mdandTHREAT_MODEL.mdfeed nothing in the build, packaging or runtime, yet every edit to them ran the full JDK matrix plus Sonar, CodeQL, OWASP and the ASF Jenkins build.The first cut added them beside
.claude/**in everypaths-ignore— five copies of a list that must stay identical, plus a sixth in themaven.ymlchangesjob. Path filters underon:can't be shared (no anchors, no variables), so the decision moves out of the triggers into one reusable workflow.Changes
changes.yml(workflow_call) — owns the skip list and outputscode. Lists changed files from the pull-request files API onpull_request, from the compare API onpush, and builds for any other event (workflow_dispatch,workflow_call, a new branch) or whenever the list cannot be fetched. Patterns are anchored to the repository root:core/SECURITY.mdorSECURITY.md.bakstill build.maven.yml— the inlinechangesjob replaced byuses: ./.github/workflows/changes.yml; step-level gating on thebuildmatrix unchanged, so Build and Test (JDK 17) keeps reporting and the PR stays mergeable.sonar.yml,codeql.yml,owasp.yml— everypaths-ignoreremoved; each gets achangesjob and gates its real job withneeds/if.codeql.ymlpermissions — Sonar S8233 flagged the workflow-levelsecurity-events: write/id-token: write. Theanalyzejob has always had its own block (which replaces the workflow-level one), so those grants never reached it; the workflow level is nowcontents: readandsecurity-events: writestays on the job that uploads. Effective permissions unchanged.Jenkinsfile— Jenkins can't call a GitHub reusable workflow, so its own copy of the filter is extended to the same anchored pattern; the two copies cross-reference each other.Cost: each GitHub workflow now starts one short runner per event to evaluate the filter instead of not triggering at all.
Verification
false, PR build(ci): decide "does this need a build" in one reusable workflow #1965 →true; push compare of a docs-only commit →false, of a code commit →true; new-branchbefore, a badbefore(compare fails) andworkflow_dispatch→true.changesjobs, the full Build and Test matrix, Scan, Analyze and OWASP green on the reusable-workflow layout.CI change, no ticket.
🤖 Generated with Claude Code