Skip to content

fix(ci): Remove CI/CD check differences between PR and push events#4

Merged
konard merged 6 commits intomainfrom
issue-3-91c520cb7611
Dec 29, 2025
Merged

fix(ci): Remove CI/CD check differences between PR and push events#4
konard merged 6 commits intomainfrom
issue-3-91c520cb7611

Conversation

@konard
Copy link
Member

@konard konard commented Dec 29, 2025

Summary

This PR applies best practices from js-ai-driven-development-pipeline-template#18 to fix the issue where CI/CD checks behave differently for pull request events vs push/merge events.

Root Cause

When documentation-only PRs are merged without changesets:

  1. The changeset-check job fails with "No changeset found"
  2. Documentation-only changes shouldn't require changesets
  3. After merge, the push to main triggers lint, which could fail on unformatted files

Changes

New Script:

  • Created scripts/detect-code-changes.mjs - a cross-platform Node.js script for detecting file changes in CI/CD
  • Adapted from the JavaScript template for Java-specific file types (.java, pom.xml)
  • Replaces need for inline bash scripts for better maintainability and cross-platform support

Workflow Changes:

  • Add detect-changes job that runs the new script and outputs what types of files changed
  • Make lint job independent of changeset-check - it's a fast check that should always run
  • Make changeset-check skip for docs-only PRs by adding condition: needs.detect-changes.outputs.any-code-changed == 'true'
  • Add || needs.changeset-check.result == 'skipped' to test job to handle the new skipped state
  • Update any-code-changed detection to exclude:
    • .changeset/ folder (changeset metadata)
    • docs/ folder (documentation)
    • experiments/ folder (experimental scripts)
    • examples/ folder (example scripts)
    • All markdown files (*.md) in any folder
  • Simplify Java version matrix - test only on latest Java version (21) instead of multiple versions (17, 21)

Benefits

After this fix:

  1. Lint runs on ALL PRs regardless of changeset status
  2. Docs-only PRs don't require changesets (reducing friction for documentation updates)
  3. No differences between PR checks and push/merge checks (preventing future surprises)
  4. Changeset validation only runs when code changes (more sensible behavior)
  5. Cross-platform compatible - the detection script is written in Node.js/Bun (.mjs)
  6. Simplified CI - tests run only on latest Java version (21), reducing CI time

Testing

CI checks:

  • ✅ All lint and format checks pass
  • ✅ All tests pass on all platforms (Ubuntu, macOS, Windows) with Java 21
  • ✅ Changeset check passes
  • ✅ Build succeeds

Files Changed

  • .github/workflows/release.yml - Workflow structure updates + use new script + Java 21 only
  • scripts/detect-code-changes.mjs - NEW Cross-platform change detection script
  • .changeset/fix-ci-workflow-dependencies.md - Changeset for release
  • CHANGELOG.md - Minor formatting fix (removed extra blank lines)

Fixes #3


🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #3
@konard konard self-assigned this Dec 29, 2025
konard and others added 3 commits December 29, 2025 14:57
- Add detect-changes job with cross-platform detect-code-changes.mjs script
- Make lint job independent of changeset-check (runs based on file changes only)
- Allow docs-only PRs without changeset requirement
- Handle changeset-check 'skipped' state in dependent jobs
- Exclude .changeset/, docs/, experiments/, examples/ folders and markdown files from code changes detection

Fixes #3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use 'my-package' instead of 'java-ai-driven-development-pipeline-template' in changeset
- Remove extra blank lines from CHANGELOG.md to pass Spotless check

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The file requires a trailing newline for Spotless check to pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard changed the title [WIP] Apply best practices from https://github.com/link-foundation/js-ai-driven-development-pipeline-template/pull/18 fix(ci): Remove CI/CD check differences between PR and push events Dec 29, 2025
@konard konard marked this pull request as ready for review December 29, 2025 14:08
@konard
Copy link
Member Author

konard commented Dec 29, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $3.958534 USD
  • Calculated by Anthropic: $2.768571 USD
  • Difference: $-1.189962 (-30.06%)
    📎 Log file uploaded as GitHub Gist (679KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Dec 29, 2025

In template we need to have tests only for single latest version of Java.

@konard konard marked this pull request as draft December 29, 2025 14:35
@konard
Copy link
Member Author

konard commented Dec 29, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-29T14:35:39.104Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

- Change CI test matrix from Java 17+21 to Java 21 only
- Update env.JAVA_VERSION to 21 for consistency across workflow
- Update Codecov upload condition to match new Java version

This simplifies the template CI by testing only on the latest Java version,
as requested for the template repository.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard marked this pull request as ready for review December 29, 2025 14:40
@konard
Copy link
Member Author

konard commented Dec 29, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.105282 USD
  • Calculated by Anthropic: $0.728567 USD
  • Difference: $-0.376715 (-34.08%)
    📎 Log file uploaded as GitHub Gist (260KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard konard merged commit 450a10e into main Dec 29, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply best practices from https://github.com/link-foundation/js-ai-driven-development-pipeline-template/pull/18

1 participant