Files
struts/.github/workflows/codeql.yml
T
Lukasz Lenart 0ef20170ce build(ci): stop .claude-only changes from triggering full builds (#1846)
Editing an agent skill rebuilt the whole project on GitHub Actions and
Jenkins. No code changes, so every one of those runs was wasted.

GitHub Actions, non-required workflows (codeql, owasp, sonar): plain
paths-ignore on both push and pull_request. Nothing they report is
required in .asf.yaml, so a run that never happens blocks nothing.

GitHub Actions, maven.yml: paths-ignore on push only. It is deliberately
NOT applied to pull_request, because "Build and Test (JDK 17)" is a
required check and GitHub documents that a workflow skipped by path
filtering never reports - the check stays Pending and the pull request
can never be merged. Instead a small `changes` job inspects the PR's
file list and the build job is skipped by condition. A job skipped that
way does report, as "skipped", and required checks accept "successful,
skipped, or neutral".

Jenkins polls SCM, so the trigger cannot be filtered; the two JDK stages
are guarded instead. Detection fails open - no previous successful
commit, an unreachable commit, or any git error reports true and the
build runs exactly as before.

The filter tests for a non-empty list of files outside .claude/ rather
than using `grep -qv`: the local ugrep 7.5.0 returns 1 from `-qv` on
input where `-cv` counts 1 and `-v` prints the line, which silently
inverts the decision. Testing emptiness behaves the same everywhere.
Exercised against six inputs, including the mixed .claude/ + code case
that must still build, and .claudefoo/ which must not be treated as
.claude/.

Only the 7.x line is changed here; support/struts-6-x-x needs the same
edit on its own branch.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 12:48:33 +02:00

71 lines
2.0 KiB
YAML

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache license, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the license for the specific language governing permissions and
# limitations under the license.
name: "CodeQL"
on:
push:
branches:
- 'main'
- 'release/*'
- 'support/*'
paths-ignore:
- '.claude/**'
# Safe to filter by path here: no check from this workflow is required in
# .asf.yaml, so a run that never happens blocks nothing.
pull_request:
paths-ignore:
- '.claude/**'
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
actions: read
contents: read
# Needed to access OIDC token.
id-token: write
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Java JDK
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: 'maven'
- name: Initialize CodeQL
uses: github/codeql-action/init@v4.37.6
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v4.37.6
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4.37.6
with:
category: "/language:${{matrix.language}}"