Skip to content

Conversation

taj54
Copy link
Member

@taj54 taj54 commented Aug 19, 2025

  • Updated release notes extraction to prepend heading based on release type
    • πŸš€ Major Release
    • ✨ Minor Release
  • Ensures GitHub release body includes contextual heading + changelog content

Summary by CodeRabbit

  • Chores
    • Introduced automated version tagging and GitHub Releases after merges to main.
    • Creates releases for major and minor versions; patch updates do not produce a tag or release.
    • Generates release notes from the changelog and includes them in the release body.
    • Automatically names releases and publishes them with the appropriate tag for improved release visibility.

taj54 and others added 3 commits August 19, 2025 17:46
- Updated release notes extraction to prepend heading based on release type
  - πŸš€ Major Release
  - ✨ Minor Release
- Ensures GitHub release body includes contextual heading + changelog content
@taj54 taj54 self-assigned this Aug 19, 2025
Copy link
Contributor

coderabbitai bot commented Aug 19, 2025

Walkthrough

Adds a new GitHub Actions workflow to tag and create GitHub Releases after merges to main by comparing the new package.json version to the last tag, classifying the change (major/minor/patch), tagging and releasing for major/minor, and assembling release notes from CHANGELOG.md.

Changes

Cohort / File(s) Summary
Release automation workflow
.github/workflows/tag-after-merge.yml
Introduces a workflow that: checks out full history, reads version from package.json, finds last tag, classifies release (major/minor/patch), conditionally creates/pushes tag v, extracts notes from CHANGELOG.md, and creates a GitHub Release via softprops/action-gh-release.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Merge to main
    participant GH as GitHub Actions Runner
    participant Repo as Repo (git)
    participant Chg as CHANGELOG.md
    participant GHRel as GitHub Releases

    Dev->>GH: Trigger workflow (push to main)
    GH->>Repo: actions/checkout (fetch-depth: 0)
    GH->>Repo: Read package.json (version)
    GH->>Repo: Get last tag (or v0.0.0)
    GH->>GH: Compare versions (major/minor/patch)
    alt Major or Minor
        GH->>Repo: git tag v<version> & push
        GH->>Chg: Extract notes for <version>
        GH->>GHRel: Create Release (tag v<version>, name, body)
        Note right of GHRel: Release published
    else Patch
        Note right of GH: Skip tagging and release
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at version’s chime,
From main’s fresh merge to tags in time.
I nibble notes from CHANGELOG leaves,
Then hop to craft the next release.
A minor leap, a major boundβ€”
Patch naps quietly, without a sound. πŸ‡βœ¨

Tip

πŸ”Œ Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
πŸ§ͺ Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@taj54 taj54 merged commit a19487b into interactive-video-labs:main Aug 19, 2025
1 of 2 checks passed
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: 3

🧹 Nitpick comments (2)
.github/workflows/tag-after-merge.yml (2)

31-50: Constrain β€œminor” detection to the same major.

If the major ever regresses accidentally, the current logic could classify a β€œminor” based solely on NEW_MINOR > OLD_MINOR. Add a guard that the majors match before considering it β€œminor”.

Apply this diff:

           if [ "$NEW_MAJOR" -gt "$OLD_MAJOR" ]; then
             echo "release_type=major" >> $GITHUB_ENV
-          elif [ "$NEW_MINOR" -gt "$OLD_MINOR" ]; then
+          elif [ "$NEW_MAJOR" -eq "$OLD_MAJOR" ] && [ "$NEW_MINOR" -gt "$OLD_MINOR" ]; then
             echo "release_type=minor" >> $GITHUB_ENV
           else
             echo "release_type=patch" >> $GITHUB_ENV
           fi

Optional: If you expect pre-release versions (e.g., 1.2.3-beta.1), consider a semver-aware comparison to avoid β€œinteger expression expected” errors.


70-70: Remove trailing whitespace to satisfy yamllint.

Line 70 contains trailing spaces flagged by yamllint.

Apply this diff:

-          
+
πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

πŸ’‘ Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 dc3d834 and 9d5990a.

πŸ“’ Files selected for processing (1)
  • .github/workflows/tag-after-merge.yml (1 hunks)
🧰 Additional context used
πŸͺ› YAMLlint (1.37.1)
.github/workflows/tag-after-merge.yml

[error] 70-70: trailing spaces

(trailing-spaces)

πŸ”‡ Additional comments (4)
.github/workflows/tag-after-merge.yml (4)

25-30: Heads-up: last-tag resolution depends on tags being fetched.

Once you enable fetch-tags: true in checkout (see prior comment), this step will behave correctly. Without it, git describe --tags --abbrev=0 may not find existing tags on the runner.

Do you want me to wire a safeguard that falls back to the latest semver tag from git tag --list 'v*' if git describe fails?


71-76: Nice: clear contextual heading in the release body.

Prepending "πŸš€ Major Release" / "✨ Minor Release" hits the PR goal and improves release readability.


20-24: LGTM on version extraction.

Using jq to read package.json version is simple and robust on ubuntu-latest.


81-89: Release creation looks correct.

softprops/action-gh-release@v2 with GITHUB_TOKEN and a multi-line body from env is a solid approach.

Comment on lines +16 to +19
uses: actions/checkout@v5
with:
fetch-depth: 0

Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

Fix checkout action version and fetch tags to enable tag discovery.

actions/checkout@v5 is not a valid published version today, and tags are not fetched by default. Without tags, git describe --tags may return nothing even when tags exist, and the job will misclassify or skip releases.

Apply this diff:

-      - name: Checkout code
-        uses: actions/checkout@v5
-        with:
-          fetch-depth: 0
+      - name: Checkout code
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+          fetch-tags: true
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
πŸ€– Prompt for AI Agents
In .github/workflows/tag-after-merge.yml around lines 16 to 19, the checkout
step uses an invalid action version and does not enable fetching tags; update
the uses to a published version (e.g., actions/checkout@v4) and add fetch-tags:
true alongside fetch-depth: 0 under the with block so the job fetches tags and
git describe --tags can discover them.

Comment on lines +56 to +63
- name: Create and push git tag
if: env.release_type != 'patch'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag v${{ env.version }}
git push origin v${{ env.version }}

Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

Avoid failures when tag already exists; create annotated tags.

Re-runs or manual tags will cause git tag vX.Y.Z to fail. Guard against existing tags and prefer annotated tags for better provenance.

Apply this diff:

       - name: Create and push git tag
         if: env.release_type != 'patch'
         run: |
-          git config user.name "github-actions[bot]"
-          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
-          git tag v${{ env.version }}
-          git push origin v${{ env.version }}
+          set -euo pipefail
+          git config user.name "github-actions[bot]"
+          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+          if git rev-parse -q --verify "refs/tags/v${{ env.version }}" >/dev/null; then
+            echo "Tag v${{ env.version }} already exists. Skipping tag creation."
+          else
+            git tag -a "v${{ env.version }}" -m "Release v${{ env.version }}"
+            git push origin "v${{ env.version }}"
+          fi
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Create and push git tag
if: env.release_type != 'patch'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag v${{ env.version }}
git push origin v${{ env.version }}
- name: Create and push git tag
if: env.release_type != 'patch'
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if git rev-parse -q --verify "refs/tags/v${{ env.version }}" >/dev/null; then
echo "Tag v${{ env.version }} already exists. Skipping tag creation."
else
git tag -a "v${{ env.version }}" -m "Release v${{ env.version }}"
git push origin "v${{ env.version }}"
fi
πŸ€– Prompt for AI Agents
In .github/workflows/tag-after-merge.yml around lines 56 to 63, the workflow
currently runs git tag v${{ env.version }} which fails if the tag already exists
and creates lightweight tags; change it to check for an existing tag and create
an annotated tag only when missing. Add a check like git rev-parse -q --verify
"refs/tags/v${{ env.version }}" and if it returns non-zero create an annotated
tag with git tag -a v${{ env.version }} -m "Release v${{ env.version }}" and
push that tag with git push origin v${{ env.version }}, otherwise skip tagging
(echo that tag exists) so re-runs do not fail.

Comment on lines +68 to +79
# Match lines starting with "## vX.Y.Z " until the next "## "
awk "/^## v${{ env.version }}[[:space:]]/{flag=1; next} /^## /{flag=0} flag" CHANGELOG.md > RELEASE_NOTES.md

echo "notes<<EOF" >> $GITHUB_ENV
if [ "${{ env.release_type }}" = "major" ]; then
echo "## πŸš€ Major Release" >> $GITHUB_ENV
elif [ "${{ env.release_type }}" = "minor" ]; then
echo "## ✨ Minor Release" >> $GITHUB_ENV
fi
echo "" >> $GITHUB_ENV
cat RELEASE_NOTES.md >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

Make changelog extraction robust and fail if notes are missing; also streamline env write.

The current AWK requires a space after the version (^## vX.Y.Z[[:space:]]) and may miss headings like ## v1.2.3 or [v1.2.3] - 2025-08-19. Also, we should fail fast if no section is found to avoid empty releases.

Apply this diff:

       - name: Extract release notes from CHANGELOG
         if: env.release_type != 'patch'
         id: changelog
         run: |
-          # Match lines starting with "## vX.Y.Z " until the next "## "
-          awk "/^## v${{ env.version }}[[:space:]]/{flag=1; next} /^## /{flag=0} flag" CHANGELOG.md > RELEASE_NOTES.md
-        
-          echo "notes<<EOF" >> $GITHUB_ENV
-          if [ "${{ env.release_type }}" = "major" ]; then
-            echo "## πŸš€ Major Release" >> $GITHUB_ENV
-          elif [ "${{ env.release_type }}" = "minor" ]; then
-            echo "## ✨ Minor Release" >> $GITHUB_ENV
-          fi
-          echo "" >> $GITHUB_ENV
-          cat RELEASE_NOTES.md >> $GITHUB_ENV
-          echo "EOF" >> $GITHUB_ENV
+          # Extract lines from the "## vX.Y.Z" (or "[vX.Y.Z]") section until the next "##"
+          awk -v VER="v${{ env.version }}" '
+            $0 ~ "^##[[:space:]]*\\[?" VER "\\]?([[:space:]]|$)" {flag=1; next}
+            /^##[[:space:]]/ && flag {exit}
+            flag
+          ' CHANGELOG.md > RELEASE_NOTES.md
+
+          if [ ! -s RELEASE_NOTES.md ]; then
+            echo "No changelog section found for v${{ env.version }} in CHANGELOG.md"
+            exit 1
+          fi
+
+          {
+            echo "notes<<EOF"
+            if [ "${{ env.release_type }}" = "major" ]; then
+              echo "## πŸš€ Major Release"
+            elif [ "${{ env.release_type }}" = "minor" ]; then
+              echo "## ✨ Minor Release"
+            fi
+            echo ""
+            cat RELEASE_NOTES.md
+            echo "EOF"
+          } >> "$GITHUB_ENV"
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Match lines starting with "## vX.Y.Z " until the next "## "
awk "/^## v${{ env.version }}[[:space:]]/{flag=1; next} /^## /{flag=0} flag" CHANGELOG.md > RELEASE_NOTES.md
echo "notes<<EOF" >> $GITHUB_ENV
if [ "${{ env.release_type }}" = "major" ]; then
echo "## πŸš€ Major Release" >> $GITHUB_ENV
elif [ "${{ env.release_type }}" = "minor" ]; then
echo "## ✨ Minor Release" >> $GITHUB_ENV
fi
echo "" >> $GITHUB_ENV
cat RELEASE_NOTES.md >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Extract release notes from CHANGELOG
if: env.release_type != 'patch'
id: changelog
run: |
# Extract lines from the "## vX.Y.Z" (or "[vX.Y.Z]") section until the next "##"
awk -v VER="v${{ env.version }}" '
$0 ~ "^##[[:space:]]*\\[?" VER "\\]?([[:space:]]|$)" {flag=1; next}
/^##[[:space:]]/ && flag {exit}
flag
' CHANGELOG.md > RELEASE_NOTES.md
if [ ! -s RELEASE_NOTES.md ]; then
echo "No changelog section found for v${{ env.version }} in CHANGELOG.md"
exit 1
fi
{
echo "notes<<EOF"
if [ "${{ env.release_type }}" = "major" ]; then
echo "## πŸš€ Major Release"
elif [ "${{ env.release_type }}" = "minor" ]; then
echo "## ✨ Minor Release"
fi
echo ""
cat RELEASE_NOTES.md
echo "EOF"
} >> "$GITHUB_ENV"
🧰 Tools
πŸͺ› YAMLlint (1.37.1)

[error] 70-70: trailing spaces

(trailing-spaces)

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.

1 participant