Skip to content

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

Merged
konard merged 3 commits intomainfrom
issue-4-fdcc3757e947
Dec 29, 2025
Merged

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

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 changelog fragments:

  1. The changelog job fails with "No changelog fragment found"
  2. The lint job depends on changelog succeeding
  3. Ruff/mypy never run on these PRs
  4. After merge, the push to main triggers lint, which could fail on unformatted files

Changes

New Script:

  • Created scripts/detect_code_changes.py - a cross-platform Python script for detecting file changes in CI/CD
  • 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 changelog - it's a fast check that should always run
  • Make changelog skip for docs-only PRs by adding condition: needs.detect-changes.outputs.any-code-changed == 'true'
  • Add || needs.lint.result == 'skipped' and || needs.test.result == 'skipped' to build job to handle the new skipped states
  • Update any-code-changed detection to exclude:
    • changelog.d/ folder (changelog metadata)
    • docs/ folder (documentation)
    • experiments/ folder (experimental scripts)
    • examples/ folder (example scripts)
    • All markdown files (*.md) in any folder

Benefits

After this fix:

  1. Lint and tests run on ALL PRs regardless of changelog status
  2. Docs-only PRs don't require changelog fragments (reducing friction for documentation updates)
  3. No differences between PR checks and push/merge checks (preventing future surprises)
  4. Changelog validation only runs when code changes (more sensible behavior)
  5. Cross-platform compatible - the detection script is written in Python

Testing

Local checks:

  • ruff check . passes
  • ruff format --check . passes
  • mypy src passes
  • pytest tests/ passes

Files Changed

  • .github/workflows/release.yml - Workflow structure updates + use new script
  • scripts/detect_code_changes.py - NEW Cross-platform change detection script

Fixes #4


🤖 Generated with Claude Code

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

Issue: #4
@konard konard self-assigned this Dec 29, 2025
This 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.

Changes:

- Add `detect-changes` job with cross-platform `detect_code_changes.py` script
- Make lint job independent of changelog check (runs based on file changes only)
- Allow docs-only PRs without changelog requirement
- Handle changelog-check 'skipped' state in dependent jobs
- Exclude `changelog.d/`, `docs/`, `experiments/`, `examples/` folders
  and markdown files from code changes detection

Benefits:

1. Lint and tests run on ALL PRs regardless of changelog status
2. Docs-only PRs don't require changelog fragments (reducing friction for documentation updates)
3. No differences between PR checks and push/merge checks (preventing future surprises)
4. Changelog validation only runs when code changes (more sensible behavior)
5. Cross-platform compatible - the detection script is written in Python

🤖 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 13:43
@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: $2.021178 USD
  • Calculated by Anthropic: $1.656684 USD
  • Difference: $-0.364493 (-18.03%)
    📎 Log file uploaded as GitHub Gist (607KB)
    🔗 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 2967643 into main Dec 29, 2025
7 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

Comments