mirror of
https://github.com/apache/struts.git
synced 2026-09-12 17:15:02 +00:00
0ef20170ce
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>
62 lines
2.2 KiB
YAML
62 lines
2.2 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: SonarCloud
|
|
|
|
on:
|
|
# 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/**'
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
paths-ignore:
|
|
- '.claude/**'
|
|
|
|
permissions: read-all
|
|
|
|
env:
|
|
MAVEN_OPTS: -Xmx2048m -Xms1024m
|
|
LANG: en_US.utf8
|
|
HAVE_SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN != '' }}
|
|
|
|
jobs:
|
|
sonarcloud:
|
|
name: Scan
|
|
runs-on: ubuntu-latest
|
|
if: ${{ !github.event.pull_request.base.repo.fork && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }}
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: 21
|
|
cache: 'maven'
|
|
- name: SonarCloud Scan
|
|
if: ${{ env.HAVE_SONARCLOUD_TOKEN == 'true' }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
|
|
run: ./mvnw -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage -DskipAssembly
|
|
- name: SonarCloud Scan -- SKIPPED
|
|
if: ${{ env.HAVE_SONARCLOUD_TOKEN != 'true' }}
|
|
run: |
|
|
echo "### SonarCloud not configured" >> $GITHUB_STEP_SUMMARY
|
|
echo "secrets.SONARCLOUD_TOKEN not existing, cannot push coverage checks" >> $GITHUB_STEP_SUMMARY
|