You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@struts.apache.org by "lukaszlenart (via GitHub)" <gi...@apache.org> on 2026/07/01 07:53:30 UTC

[PR] ci: skip staging site build when a PR changes no site files [struts-site]

lukaszlenart opened a new pull request, #311:
URL: https://github.com/apache/struts-site/pull/311

   The `Struts-site` multibranch job rebuilds Jekyll and pushes to `asf-staging` on **every** PR — including PRs that only touch CI or `docs/` and leave `source/` untouched. The staged output is then byte-identical, so the whole build + deploy + PR comment is wasted.
   
   ## Fix
   Add a lightweight **Check for site changes** stage that diffs the PR against its target branch and sets `SITE_CHANGED`, then gate the existing stages on it:
   
   ```groovy
   stage('Check for site changes') {
     steps {
       script {
         if (env.CHANGE_TARGET) {
           sh "git fetch --no-tags origin +refs/heads/${env.CHANGE_TARGET}:refs/remotes/origin/${env.CHANGE_TARGET}"
           def files = sh(script: "git diff --name-only origin/${env.CHANGE_TARGET}...HEAD", returnStdout: true).trim()
           env.SITE_CHANGED = files.readLines().any {
             it ==~ /^(source\/.*|_config\.yml|Gemfile(\.lock)?)$/
           } ? 'true' : 'false'
         } else {
           env.SITE_CHANGED = 'true'   // branch build (main): always rebuild
         }
       }
     }
   }
   ```
   
   - **Build** and **Deploy to stage area** run only when `SITE_CHANGED == 'true'`.
   - **Comment on PR** runs only on a change request *and* when the site changed.
   - Site-affecting paths: anything under `source/`, plus `_config.yml` and `Gemfile`/`Gemfile.lock`.
   
   ## Why in-pipeline (not a job-level path filter)
   A skipped stage still reports **success**, so if the `Struts-site` build is ever a required PR check, it stays green. A job-level 'included regions' filter would instead prevent the build from starting, so a required check would never report and could block merge.
   
   ## Self-test
   This PR touches only `Jenkinsfile`, so its own multibranch run should show **Build a staged website** and **Deploy to stage area** as *skipped* — that's the expected, correct outcome here.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@struts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci: skip staging site build when a PR changes no site files [struts-site]

Posted by "lukaszlenart (via GitHub)" <gi...@apache.org>.
lukaszlenart merged PR #311:
URL: https://github.com/apache/struts-site/pull/311


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@struts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org