Skip to content

fix: Changelog check detects blog posts across all PR commits#1646

Merged
aknysh merged 3 commits intomainfrom
fix-changelog-check-workflow
Oct 16, 2025
Merged

fix: Changelog check detects blog posts across all PR commits#1646
aknysh merged 3 commits intomainfrom
fix-changelog-check-workflow

Conversation

@osterman
Copy link
Member

@osterman osterman commented Oct 16, 2025

what

  • Fixed the changelog check workflow to correctly detect blog posts added in any commit of a PR, not just the latest commit
  • Changed from git diff to gh pr diff to capture all files modified in the entire PR
  • Excluded tags.yml from blog post detection (it's a meta file, not a blog post)

why

  • The workflow was failing on PRs with multiple commits because it only compared HEAD against the base branch
  • If a blog post was added in commit 1, then commits 2, 3, 4 were added, the workflow would fail on commit 4 because the blog post was no longer "new" relative to the comparison
  • This caused false positive failures, including on PR feat: Add command registry pattern foundation with 100% test coverage #1643 which had correctly added a blog post but got additional commits afterward

references

Summary by CodeRabbit

  • Chores
    • Improved changelog verification workflow: only PRs targeting the main branch with minor/major labels now require a changelog entry, with clearer messaging about requirements.
    • Enhanced detection of new blog posts by using the full PR diff for file discovery, improving accuracy for content submissions and preserving existing paths for “no changelog required” or error reporting.

The changelog check was failing on PRs with multiple commits because it
only looked at the diff between the latest commit and the base branch.
If a blog post was added in an earlier commit, subsequent commits would
not see it as a "new" file.

Changes:
- Use 'gh pr diff' instead of 'git diff' to get all files in the PR
- This captures files added in any commit of the PR, not just HEAD
- Exclude tags.yml from blog post detection (meta file, not a post)
- Add GH_TOKEN env for gh CLI authentication

This fixes false positives where:
1. Blog post added in commit A
2. Additional commits B, C pushed to PR
3. Workflow runs on commit C, doesn't see blog post as "new"

Now the workflow correctly identifies blog posts regardless of which
commit they were added in.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@osterman osterman requested a review from a team as a code owner October 16, 2025 16:29
@osterman osterman added bugfix Change that restores intended behavior no-release Do not create a new release (wait for additional code changes) labels Oct 16, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

📝 Walkthrough

Walkthrough

Replaces base-branch git-diff with a PR-scoped gh pr diff check in the changelog workflow, gates changelog requirement to PRs targeting main and labeled minor/major, exposes GH_TOKEN for the blog-check step, and excludes tags.yml from blog-post detection.

Changes

Cohort / File(s) Summary
Changelog detection workflow
​.github/workflows/changelog-check.yml
Replaced git-diff base-branch detection with gh pr diff $PR_NUMBER to collect added files across the PR; short-circuits non-main PRs via BASE_REF and requires minor/major label to mandate a changelog; filters website/blog/*.md/.mdx and excludes tags.yml; exposes GH_TOKEN to blog-check step; preserves prior messaging and has_changelog outputs.

Sequence Diagram(s)

sequenceDiagram
    participant GH as GitHub Actions
    participant GHCli as gh CLI
    participant WF as Workflow Logic

    rect rgb(255, 245, 230)
    Note over GH,WF: Branch-target gating
    GH->>GH: read BASE_REF (target branch)
    alt BASE_REF != "main"
        GH->>WF: short-circuit -> no changelog required
    else BASE_REF == "main"
        GH->>WF: continue
    end
    end

    rect rgb(230, 245, 255)
    Note over GH,GHCli: PR-scoped blog discovery
    GH->>GHCli: gh pr diff $PR_NUMBER (uses GH_TOKEN)
    GHCli-->>GH: list of files added/changed in PR
    GH->>GH: filter website/blog/*.md/*.mdx
    GH->>GH: exclude tags.yml
    alt files found
        GH->>WF: set has_changelog = true
    else no files
        GH->>WF: set has_changelog = false
    end
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • aknysh

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "fix: Changelog check detects blog posts across all PR commits" accurately and specifically describes the primary objective of this changeset. It clearly communicates that the workflow was fixed to detect blog posts across all commits in a PR, addressing the core issue that the previous implementation only checked the latest commit. The title uses standard commit message convention with the "fix:" prefix, is concise and clear, and a teammate reviewing history would immediately understand the nature of the improvement. While the raw summary reveals additional supporting changes like BASE_REF gating and condition messaging, the title appropriately focuses on the main user-facing fix rather than every detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-changelog-check-workflow

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 99ea404 and 5e9857a.

📒 Files selected for processing (1)
  • .github/workflows/changelog-check.yml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Build (macos-latest, macos)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the size/xs Extra small size PR label Oct 16, 2025
@mergify
Copy link

mergify bot commented Oct 16, 2025

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify bot added the needs-cloudposse Needs Cloud Posse assistance label Oct 16, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/changelog-check.yml (1)

40-41: Fail fast when gh pr diff blows up

|| true swallows any failure from gh pr diff, so an auth/network blip looks identical to “no blog post found”, which sends folks on a goose chase. Please surface those command failures and only relax the exit code on the final grep so we keep the helpful changelog messaging without hiding real errors. For example:

-          NEW_BLOG_FILES=$(gh pr diff $PR_NUMBER --name-only | grep -E '^website/blog/.*\.(md|mdx)$' | grep -v 'tags.yml' || true)
+          RAW_DIFF=$(gh pr diff "$PR_NUMBER" --name-only) || { echo "Failed to fetch PR diff" >&2; exit 1; }
+          NEW_BLOG_FILES=$(echo "$RAW_DIFF" | grep -E '^website/blog/.*\.(md|mdx)$' | grep -v 'tags.yml' || true)
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba4a2de and 99ea404.

📒 Files selected for processing (1)
  • .github/workflows/changelog-check.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Build (macos-latest, macos)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 16, 2025
@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.00%. Comparing base (e237f52) to head (3bf5e87).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1646      +/-   ##
==========================================
+ Coverage   64.97%   65.00%   +0.03%     
==========================================
  Files         338      338              
  Lines       37535    37535              
==========================================
+ Hits        24388    24400      +12     
+ Misses      11201    11187      -14     
- Partials     1946     1948       +2     
Flag Coverage Δ
unittests 65.00% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Changelog entries (blog posts) should only be required for PRs that
target the main branch. PRs targeting feature branches or other branches
don't need changelog entries.

Changes:
- Check PR base ref before requiring changelog
- Skip changelog check if base ref is not 'main'
- Update step name to clarify it checks both label and target branch
- Add clear messaging when skipping due to non-main target

This allows:
- Feature branch PRs to skip changelog requirements
- Backport PRs to release branches to skip changelog requirements
- Only main-bound PRs with minor/major labels need changelog entries

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

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added size/s Small size PR and removed size/xs Extra small size PR labels Oct 16, 2025
@aknysh aknysh merged commit 6e04105 into main Oct 16, 2025
53 checks passed
@aknysh aknysh deleted the fix-changelog-check-workflow branch October 16, 2025 21:26
@mergify mergify bot removed the needs-cloudposse Needs Cloud Posse assistance label Oct 16, 2025
@github-actions
Copy link

These changes were released in v1.195.0-test.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Change that restores intended behavior no-release Do not create a new release (wait for additional code changes) size/s Small size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants