Skip to content

docs: add CHANGELOG.md and automate release drafting#184

Merged
yash-pouranik merged 10 commits into
geturbackend:mainfrom
Mansi0905:docs/add-changelog
May 21, 2026
Merged

docs: add CHANGELOG.md and automate release drafting#184
yash-pouranik merged 10 commits into
geturbackend:mainfrom
Mansi0905:docs/add-changelog

Conversation

@Mansi0905
Copy link
Copy Markdown
Contributor

@Mansi0905 Mansi0905 commented May 19, 2026

Description

This PR addresses the missing and fragmented changelogs by introducing a unified CHANGELOG.md and setting up automated release drafting workflows. This dual-solution provides clear historical context for users and eliminates manual overhead for maintainers when cutting new releases.

Key Changes

  1. Structured CHANGELOG.md:

    • Consolidated and formatted all historical release notes from versions v0.1.0 through v0.9.0 into a single file in the root directory.
    • Strictly followed the Keep a Changelog specifications and Semantic Versioning guidelines, categorizing historical changes under Added, Changed, Fixed, and Security.
  2. Automated Release notes Workflow:

    • Added .github/workflows/release-drafter.yml to trigger the automatic update of draft releases when Pull Requests are merged into the main branch.
    • Added .github/release-drafter.yml to configure the Release Drafter. It maps labels on merged Pull Requests (like feat, fix, docs, security) to the corresponding headings in the draft release notes and automatically calculates the next semantic version number.

Related Issues

Closes #183

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own work
  • My changes generate no new warnings
  • I have verified that files are placed in their correct respective folders (.github/ and .github/workflows/)

Summary by CodeRabbit

  • Chores

    • Added automated release-drafting with standardized version tags, release-note formatting, and category mapping (including Security and Breaking Changes).
    • Added a weekly changelog workflow and script to generate, prepend, and open PRs for changelog entries automatically.
  • Documentation

    • Added a complete CHANGELOG (Keep a Changelog / SemVer) with Unreleased and historical releases through v0.9.0.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

Warning

Rate limit exceeded

@Mansi0905 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 53 minutes and 23 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c7050c25-1224-419e-adce-4b252f135e8d

📥 Commits

Reviewing files that changed from the base of the PR and between e839bf1 and ff2967a.

📒 Files selected for processing (1)
  • .github/workflows/weekly-changelog.yml
📝 Walkthrough

Walkthrough

Adds release-drafter configuration and workflow, a weekly scheduled changelog workflow plus a Groq-backed changelog generator script, and a project CHANGELOG.md documenting releases v0.1.0–v0.9.0.

Changes

Release Notes Automation and Changelog

Layer / File(s) Summary
Release Drafter configuration
.github/release-drafter.yml
Sets release name-template/tag-template to v$RESOLVED_VERSION, updates version-resolver (adds securitypatch, default: patch), defines categories (Added/Fixed/Security/Breaking Changes/Documentation/Chore), and configures change-template, change-title-escapes, and the release template including $CHANGES and a Full Changelog compare link.
Release Drafter Workflow
.github/workflows/release-drafter.yml
Adds a workflow triggered on pushes to main/master that runs the pinned release-drafter/release-drafter action with contents: write permission and GITHUB_TOKEN.
Weekly changelog workflow
.github/workflows/weekly-changelog.yml
Adds a scheduled and manually triggerable workflow that collects merged PRs from the last 7 days, generates a markdown entry via the Groq-backed script, inserts the entry into mintlify/docs/changelog/<month>-<year>.mdx, and opens a PR when changes exist.
Groq-backed changelog generator
.github/scripts/generate-changelog-entry.js
Adds a Node.js script that builds a fixed prompt, calls the Groq Chat Completions API (api.groq.com), validates choices[0].message.content, handles API/JSON/request errors and timeouts, and prints the trimmed MDX changelog block.
Project CHANGELOG Documentation
CHANGELOG.md
Adds a complete CHANGELOG.md using Keep a Changelog format with an Unreleased section and versioned notes for v0.1.0v0.9.0 (Added/Changed/Fixed/Security sections as present).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble changelogs in the night,
I stitch releases tidy and tight,
Labels hop to bump and patch,
Drafts and entries all dispatch,
Hooray—automation hops to light!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly summarizes the main changes: adding CHANGELOG.md and automating release drafting via Release Drafter workflow.
Linked Issues check ✅ Passed PR addresses all scope items from issue #183: adds CHANGELOG.md (v0.1.0–v0.9.0 per Keep a Changelog format), Release Drafter automation (.github/workflows/release-drafter.yml and .github/release-drafter.yml with label-to-semver mapping), and weekly Mintlify changelog automation (.github/workflows/weekly-changelog.yml and .github/scripts/generate-changelog-entry.js using Groq API).
Out of Scope Changes check ✅ Passed All changes are directly within scope: CHANGELOG.md (docs), release-drafter config and workflow, and weekly-changelog workflow and Groq script match the linked issue objectives with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown
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: 2

🧹 Nitpick comments (1)
.github/workflows/release-drafter.yml (1)

8-9: ⚡ Quick win

Prefer running this workflow only on default-branch pushes.

Lines 8-9 add PR-event runs that are unnecessary for “merged-to-main” release drafting and can create noisy or permission-constrained runs.

Proposed simplification
 on:
   push:
     branches:
       - main
       - master
-  pull_request:
-    types: [opened, reopened, synchronize]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release-drafter.yml around lines 8 - 9, The workflow
currently triggers on pull_request events (the pull_request block) which is
unnecessary; remove the pull_request trigger (or restrict it) and ensure the
workflow only runs on pushes to the default branch by keeping/adding a push
trigger with branches set to your default branch (e.g., branches: [main] or your
repo's default branch name) so release drafting runs only on
merged-to-default-branch pushes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release-drafter.yml:
- Line 22: Replace the movable tag "release-drafter/release-drafter@v6" with the
full commit SHA that corresponds to the v6.4.0 release (i.e., change the uses
line in the workflow to "release-drafter/release-drafter@<full-commit-sha>");
locate the correct SHA from the release-drafter GitHub repo (the v6.4.0 tag or
release commit) and use that exact SHA so the action is pinned to an immutable
commit.

In `@CHANGELOG.md`:
- Around line 1-132: Add standard Keep a Changelog headings: make the top line a
level-1 title "Changelog", keep the one-line project description as a paragraph
under it, then introduce a "## [Unreleased]" section (if applicable) followed by
each released version as level-2 headings like "## [0.9.0] - 2026-04-15" and
convert each release's categories into level-3 headings "### Added", "###
Changed", "### Fixed" grouping the listed items under those subheadings; ensure
existing version markers such as "[0.9.0]" and section labels ("Added",
"Changed", "Fixed") are preserved but promoted to the appropriate Markdown
heading levels.

---

Nitpick comments:
In @.github/workflows/release-drafter.yml:
- Around line 8-9: The workflow currently triggers on pull_request events (the
pull_request block) which is unnecessary; remove the pull_request trigger (or
restrict it) and ensure the workflow only runs on pushes to the default branch
by keeping/adding a push trigger with branches set to your default branch (e.g.,
branches: [main] or your repo's default branch name) so release drafting runs
only on merged-to-default-branch pushes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 19cfc916-4223-4dcc-890c-9a799b7cc0fe

📥 Commits

Reviewing files that changed from the base of the PR and between f3cd28f and 7dcb81d.

📒 Files selected for processing (3)
  • .github/release-drafter.yml
  • .github/workflows/release-drafter.yml
  • CHANGELOG.md

Comment thread .github/workflows/release-drafter.yml Outdated
Comment thread CHANGELOG.md Outdated
@yash-pouranik
Copy link
Copy Markdown
Collaborator

Is This really usefull For urBackend?
or things needs update.(I feel so)
@coderabbitai

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

Great question, @yash-pouranik — let me check the actual state of the repo (existing releases, labels, and the PR's CHANGELOG) before giving a proper assessment.


🏁 Script executed:

#!/bin/bash
echo "=== GitHub Releases ==="
gh release list --repo geturbackend/urBackend --limit 20

echo ""
echo "=== Repository Labels ==="
gh label list --repo geturbackend/urBackend

echo ""
echo "=== CHANGELOG.md content (from PR branch) ==="
cat CHANGELOG.md 2>/dev/null | head -80

echo ""
echo "=== Release Drafter config ==="
cat .github/release-drafter.yml 2>/dev/null

echo ""
echo "=== Release Drafter workflow ==="
cat .github/workflows/release-drafter.yml 2>/dev/null

Length of output: 6092


@yash-pouranik — your instinct is right. This PR needs significant updates before it's useful. Here's a breakdown of the concrete problems found:


❌ 1. CHANGELOG.md Dates Are Wrong (Fabricated)

The dates in the CHANGELOG don't match the actual GitHub release dates at all:

Version Actual Release Date CHANGELOG Date
v0.9.0 2026-04-08 2026-04-15 ❌
v0.8.0 2026-04-06 2026-02-10 ❌
v0.7.0 2026-04-04 2025-12-05 ❌
v0.6.0 2026-03-31 2025-10-18 ❌
v0.5.0 2026-03-29 2025-08-12 ❌

❌ 2. CHANGELOG.md Content Doesn't Match Actual Releases

The written entries appear to be fabricated and don't reflect what was actually shipped:

  • v0.9.0 actual: "Webhook and Bring your own key (Resend) for Mails" — but the CHANGELOG says multi-database support, custom domains, billing integrations, auto-generated SDKs.
  • v0.8.0 actual: "Social Authentication with GitHub & Google OAuth" — but the CHANGELOG says API Rate Limiting, Webhooks, RBAC.

The entries need to be sourced directly from the existing GitHub Releases page, not written from scratch.


❌ 3. Release Drafter Labels Don't Match Repo Labels

The release-drafter config references labels that don't exist in this repo:

Label in Config Exists in Repo?
feat ❌ No
refactor ❌ No
performance ❌ No
change ❌ No
security ❌ No
major, minor, patch ❌ No
feature, bug, enhancement, documentation ✅ Yes

Consequences:

  • The "🔄 Changed" and "🔒 Security" changelog categories will never be populated — no PR can ever match those labels.
  • The version resolver will always default to patch since major, minor, and feat labels don't exist — it can never bump to a minor or major version automatically.

✅ What's Good

  • The workflow file (.github/workflows/release-drafter.yml) is structurally correct.
  • The overall idea of adding a CHANGELOG and release automation is valuable for the project.

Suggested Fixes

  1. Fix CHANGELOG dates and content — pull the actual descriptions from the GitHub Releases page.
  2. Update .github/release-drafter.yml to use labels that actually exist in the repo, e.g.:
version-resolver:
  minor:
    labels:
      - "feature"
      - "enhancement"
  patch:
    labels:
      - "bug"
      - "chore"
  default: "patch"

categories:
  - title: "🚀 Added"
    labels:
      - "feature"
      - "enhancement"
  - title: "🐛 Fixed"
    labels:
      - "bug"
  - title: "📝 Documentation"
    labels:
      - "documentation"

Would you like me to open a review comment on the PR directly flagging these issues?

🐇 (¬_¬)ノ — good catch!

Copy link
Copy Markdown
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.

🧹 Nitpick comments (2)
.github/release-drafter.yml (2)

4-26: ⚡ Quick win

Consider adding categories for security fixes and breaking changes.

Common release-drafter configurations include categories for security vulnerabilities and breaking changes to highlight critical updates. Without them, security fixes and breaking changes may be grouped under generic categories or omitted entirely.

♻️ Suggested configuration additions

Add to version-resolver:

version-resolver:
+ major:
+   labels:
+     - 'breaking'
  minor:
    labels:
      - 'feature'
      - 'enhancement'
  patch:
    labels:
      - 'bug'
      - 'chore'
      - 'documentation'
+     - 'security'
  default: patch

Add to categories:

categories:
  - title: '🚀 Added'
    labels:
      - 'feature'
      - 'enhancement'
  - title: '🐛 Fixed'
    labels:
      - 'bug'
+ - title: '🔒 Security'
+   labels:
+     - 'security'
+ - title: '💥 Breaking Changes'
+   labels:
+     - 'breaking'
  - title: '📝 Documentation'
    labels:
      - 'documentation'
  - title: '🧹 Chore'
    labels:
      - 'chore'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/release-drafter.yml around lines 4 - 26, Add explicit "security" and
"breaking" entries to both the version-resolver and categories sections so
security fixes and breaking changes are identified and released correctly:
update the version-resolver to include a "security" level (mapped to a label
like 'security') and a "major" or "breaking" level (mapped to a 'breaking' or
'major' label), and add corresponding category blocks under categories with
titles like '🔒 Security' (labels: 'security') and '⚠️ Breaking changes'
(labels: 'breaking' or 'major') so that the release-drafter YAML recognizes and
highlights those PRs; ensure the label names match your repo's existing labels
and reference the top-level keys version-resolver and categories when making the
edits.

12-12: ⚡ Quick win

The chore label has no corresponding changelog category.

Line 12 includes chore in the patch version bump rules, but no category in lines 16–26 includes chore. PRs labeled with chore will bump the patch version but won't appear in the generated release notes.

♻️ Add a category for chore changes
  - title: '📝 Documentation'
    labels:
      - 'documentation'
+ - title: '🧹 Chore'
+   labels:
+     - 'chore'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/release-drafter.yml at line 12, The release-drafter config lists
'chore' as a patch bump rule but has no matching changelog category, so add a
category entry that matches the 'chore' label (e.g., a category with name/title
like "Chores" and label: 'chore') under the existing categories section so PRs
labeled chore appear in release notes and still trigger patch bumps;
alternatively map 'chore' into an existing category by adding 'chore' to that
category's labels.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/release-drafter.yml:
- Around line 4-26: Add explicit "security" and "breaking" entries to both the
version-resolver and categories sections so security fixes and breaking changes
are identified and released correctly: update the version-resolver to include a
"security" level (mapped to a label like 'security') and a "major" or "breaking"
level (mapped to a 'breaking' or 'major' label), and add corresponding category
blocks under categories with titles like '🔒 Security' (labels: 'security') and
'⚠️ Breaking changes' (labels: 'breaking' or 'major') so that the
release-drafter YAML recognizes and highlights those PRs; ensure the label names
match your repo's existing labels and reference the top-level keys
version-resolver and categories when making the edits.
- Line 12: The release-drafter config lists 'chore' as a patch bump rule but has
no matching changelog category, so add a category entry that matches the 'chore'
label (e.g., a category with name/title like "Chores" and label: 'chore') under
the existing categories section so PRs labeled chore appear in release notes and
still trigger patch bumps; alternatively map 'chore' into an existing category
by adding 'chore' to that category's labels.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 016dfbf4-8596-4fe6-b402-1ec6b62a2d30

📥 Commits

Reviewing files that changed from the base of the PR and between 7dcb81d and 3e8d0d1.

📒 Files selected for processing (3)
  • .github/release-drafter.yml
  • .github/workflows/release-drafter.yml
  • CHANGELOG.md
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

@Mansi0905
Copy link
Copy Markdown
Contributor Author

@yash-pouranik u can verify again

@yash-pouranik
Copy link
Copy Markdown
Collaborator

@coderabbitai
Please check

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

Sure, let me re-check the current state of the PR branch to see if the issues have been addressed.


🏁 Script executed:

#!/bin/bash
echo "=== GitHub Releases (Actual) ==="
gh release list --repo geturbackend/urBackend --limit 20

echo ""
echo "=== Repository Labels ==="
gh label list --repo geturbackend/urBackend

echo ""
echo "=== CHANGELOG.md content (from PR branch) ==="
cat CHANGELOG.md 2>/dev/null

echo ""
echo "=== Release Drafter config ==="
cat .github/release-drafter.yml 2>/dev/null

echo ""
echo "=== Release Drafter workflow ==="
cat .github/workflows/release-drafter.yml 2>/dev/null

Length of output: 10582


@yash-pouranik — good news, most of the issues have been fixed! Here's the updated assessment:


✅ Issues Resolved

Issue Status
CHANGELOG dates wrong (v0.5.0–v0.9.0) Fixed — 1-day offsets are valid timezone differences (IST = UTC+5:30)
CHANGELOG content fabricated/mismatched Fixed — content now aligns with actual release titles and descriptions
Release-drafter labels not matching repo Mostly fixedfeature, enhancement, bug, chore, documentation all exist in the repo

⚠️ Two Minor Gaps Remaining

The release-drafter config still references 2 labels that don't exist in the repo:

Label in Config Used For Exists in Repo?
breaking Triggers major version bump + "💥 Breaking Changes" section ❌ No
security Populates "🔒 Security" section ❌ No

Impact:

  • The major version can never be bumped automatically (no breaking label to apply to PRs).
  • The 🔒 Security category in release notes will always be empty.

These are low-priority gaps — the core automation will work fine for day-to-day feature/bug/chore PRs. The author can either:

  1. Create the breaking and security labels in the repo, or
  2. Remove those two categories from .github/release-drafter.yml to keep the config clean.

Overall verdict: The PR is now in good shape and the main issues are addressed. It's ready to merge once the two minor label gaps above are decided upon.

🐇 (¬ω¬)ノ — much better after the fixes!

@yash-pouranik
Copy link
Copy Markdown
Collaborator

yash-pouranik commented May 20, 2026

I will add the required labels, can u please share how this ci will work?
@coderabbitai

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

@yash-pouranik — great! Here's how the full CI pipeline will work once the labels are added:


How the Release Drafter CI Works

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub
    participant RD as Release Drafter Action
    participant Draft as Draft Release

    Dev->>GH: Open PR with labels (e.g. "feature", "bug")
    Dev->>GH: Merge PR → push to main
    GH->>RD: Trigger release-drafter.yml workflow
    RD->>GH: Read all merged PRs since last release tag
    RD->>RD: Group by label → build changelog categories
    RD->>RD: Calculate next version via version-resolver rules
    RD->>Draft: Create/Update Draft Release with changelog + version
    Dev->>GH: Manually publish Draft Release when ready
Loading

Step-by-Step Flow

1. You label a PR before merging

Label you apply What it does
feature / enhancement Bumps minor version (e.g. v0.9.0 → v0.10.0)
bug / chore / documentation Bumps patch version (e.g. v0.9.0 → v0.9.1)
breaking (once added) Bumps major version (e.g. v0.9.0 → v1.0.0)
security (once added) Adds entry to 🔒 Security section

2. PR is merged to main

The workflow in .github/workflows/release-drafter.yml is triggered automatically.

3. Release Drafter runs

It scans all merged PRs since the last published release tag, groups their titles by label into changelog sections, and calculates the next semantic version.

4. A Draft Release is created/updated

You'll find it under Releases → Draft on GitHub. The draft body will look something like:

## What's Changed

### 🚀 Added
- Add webhook support (`#42`) by `@contributor`

### 🐛 Fixed
- Fix session token bug (`#41`) by `@contributor`

**Full Changelog**: https://github.com/geturbackend/urBackend/compare/v0.9.0...v0.10.0

5. You publish the release manually

The draft is never auto-published — you review it, tweak the notes if needed, and click Publish Release when you're ready. The tag v0.10.0 (or whatever version was resolved) is then created.


Key Point

The workflow only touches draft releases — it never publishes or tags anything automatically. You stay in full control of when a version ships. 🐇

@yash-pouranik
Copy link
Copy Markdown
Collaborator

What I need before merging this PR?
@coderabbitai

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

@yash-pouranik — based on the full analysis, here's your pre-merge checklist:


✅ Already Done (no action needed)

  • CHANGELOG dates corrected
  • CHANGELOG content matches actual GitHub releases
  • Release Drafter config uses existing repo labels (feature, enhancement, bug, chore, documentation)
  • Workflow file structure is correct

🔲 Still To Do Before (or right after) Merging

Create 2 missing labels in the repo:

Label Color suggestion Purpose
breaking #e11d48 (red) Triggers major version bump (e.g. v0.9.0 → v1.0.0)
security #7c3aed (purple) Populates 🔒 Security section in release notes

You can create them quickly via GitHub UI at Settings → Labels → New label, or I can run the gh CLI to create them for you — just say the word.


Summary

Once those 2 labels exist in the repo, the PR is ready to merge. The automation will work correctly for all day-to-day PRs immediately after merging.

🐇 (✿◠‿◠)ノ

@yash-pouranik
Copy link
Copy Markdown
Collaborator

and githubtoken?
@coderabbitai

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

@yash-pouranikno manual setup needed for the token! Here's what you need to know:


GITHUB_TOKEN — Automatic, Zero-Config

The GITHUB_TOKEN referenced in the workflow:

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

is automatically created by GitHub at the start of every workflow run. It is:

  • 🔑 Auto-generated — GitHub creates a temporary token for each run; you never create or store it yourself.
  • 🔒 Scoped to the repo — it can only act on the repository where the workflow runs.
  • ⏱️ Short-lived — it expires when the workflow job finishes.
  • 🎁 Free — available on all GitHub plans, including free accounts.

Why the contents: write Permission?

The workflow explicitly requests:

permissions:
  contents: write

This grants the token permission to create and update releases and tags — which is exactly what Release Drafter needs to write/update the draft release on your behalf.

Without this, the action would get a 403 Forbidden error when trying to create the draft.


Summary — Your Pre-Merge Checklist

Item Status
GITHUB_TOKEN setup ✅ Nothing to do — fully automatic
contents: write permission ✅ Already in the workflow file
Create breaking label 🔲 Do this before/after merging
Create security label 🔲 Do this before/after merging

You're good — just create those 2 labels and you're ready to merge! 🐇 (◕‿◕✿)

@yash-pouranik
Copy link
Copy Markdown
Collaborator

@Mansi0905 u still here
haha

@Mansi0905
Copy link
Copy Markdown
Contributor Author

yep im . the suggestions of coderabbit will be completed tomorrow .no worries r

@yash-pouranik
Copy link
Copy Markdown
Collaborator

I dont think theres any update neede?
@Mansi0905

@Mansi0905
Copy link
Copy Markdown
Contributor Author

I dont think theres any update neede? @Mansi0905

well yeah u are correct there is no need for updates atp. but let's just try to see the extra steps required. i mean we can give it a try

@yash-pouranik
Copy link
Copy Markdown
Collaborator

@coderabbitai
So this means, I should stop directly commiting to main?
only PR and merge to main?
Also please have a look at changelogs in mintlify/docs
What I want is -

  • Every week on monday changes + version updates, everything should be updated their
  • and that page is properly structured and human readable.
  • I want an automation for that
  • that should work in this way
  • every monday takes all commits from last 7 days
  • reads diff
  • and then add the changelog in mintlify docs
    ?
    hows that?

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== Repo root structure ==="
tree -L 2 --dirsfirst 2>/dev/null || ls -la

echo ""
echo "=== Find mintlify config or docs folder ==="
fd -t f "mint.json\|mint.toml\|mintlify\|changelog" --max-depth 4 2>/dev/null

echo ""
echo "=== Find any changelog pages in docs ==="
fd -t f -i "changelog" --max-depth 5 2>/dev/null

echo ""
echo "=== Check if docs/ folder exists ==="
ls -la docs/ 2>/dev/null || echo "No docs/ folder found"

echo ""
echo "=== Check mint.json if present ==="
cat mint.json 2>/dev/null || find . -name "mint.json" -exec cat {} \; 2>/dev/null | head -60

echo ""
echo "=== Check for any .mdx or .md changelog files ==="
fd -e mdx -e md -t f | grep -i "changelog\|release\|versions" 2>/dev/null

echo ""
echo "=== GitHub default branch protection ==="
gh api repos/geturbackend/urBackend --jq '.default_branch, .allow_squash_merge, .allow_merge_commit, .allow_rebase_merge, .delete_branch_on_merge'

echo ""
echo "=== Branch protection rules ==="
gh api repos/geturbackend/urBackend/branches/main --jq '.protected, .protection' 2>/dev/null || echo "No protection info"

Length of output: 1405


🏁 Script executed:

#!/bin/bash
echo "=== mintlify/docs full structure ==="
tree mintlify/docs --dirsfirst 2>/dev/null || ls -laR mintlify/docs/

echo ""
echo "=== april-2026.mdx ==="
cat mintlify/docs/changelog/april-2026.mdx

echo ""
echo "=== may-2026.mdx ==="
cat mintlify/docs/changelog/may-2026.mdx

echo ""
echo "=== mint.json in mintlify/docs ==="
cat mintlify/docs/mint.json 2>/dev/null || echo "No mint.json there"

echo ""
echo "=== Any config file in mintlify/docs root ==="
ls -la mintlify/docs/

Length of output: 14564


@yash-pouranik — great idea! Here's a full breakdown of both questions:


1. Should you stop committing directly to main?

Short answer: yes, for anything non-trivial. Here's why it matters for the tooling in this PR:

Action Release Drafter Weekly Changelog Automation
Direct commit to main ❌ Ignored — it only reads merged PRs ⚠️ Captured in git log, but no PR title/label context
PR merged to main ✅ Picked up, labelled, categorised ✅ Rich context: PR title, body, labels, author

Currently your branch protection is off — so nothing enforces PRs right now. You can either:

  • Enable branch protection rules at Settings → Branches → Add rule (require PR + 1 approval), or
  • Use PRs as a team discipline without enforcement for now.

Hotfixes and tiny config tweaks can still go direct — but for features and meaningful changes, PRs give you the Release Drafter benefits automatically.


2. Weekly Mintlify Changelog Automation — Yes, this is totally doable! 🎯

Your existing format is already well-structured. Here's the design:

sequenceDiagram
    participant Cron as Monday 9AM (Cron)
    participant GH as GitHub Actions
    participant AI as OpenAI API
    participant Docs as mintlify/docs/changelog/

    Cron->>GH: Trigger workflow
    GH->>GH: git log --since=7days (merged PRs + commits)
    GH->>GH: git diff HEAD~N (last 7 days of changes)
    GH->>AI: Send commit messages + diff summary
    AI->>GH: Return <Update> block in Mintlify MDX format
    GH->>Docs: Append to current month's .mdx file
    GH->>GH: Open a PR for human review
    Note over GH: Never auto-merges — you stay in control
Loading

The output would automatically match your existing format:

<Update label="2026-05-26" description="Week of May 20–26" tags={["Feature", "Fix"]}>
## New features
...
## Bug fixes
...
</Update>

One important requirement: This needs an OpenAI API key (stored as OPENAI_API_KEY in GitHub Secrets) to read the diffs and generate human-readable summaries. Without AI, you'd only get raw commit messages formatted — which is less useful.


Plan: Weekly Mintlify Changelog Automation

  • Create .github/workflows/weekly-changelog.yml — Monday cron, collects 7-day git history, calls OpenAI, appends to the current month's MDX file, opens a PR
  • Create .github/scripts/generate-changelog-entry.js — Node.js helper script that formats the AI response into a valid Mintlify <Update> block and patches the right monthly file

Setup Checklist for the Automation

Once merged, you'll need to do one thing:

  1. Add OPENAI_API_KEY to GitHub Secrets
    → Settings → Secrets and variables → Actions → New repository secret
    → Name: OPENAI_API_KEY, Value: your OpenAI key

That's it. Every Monday at 9 AM UTC a PR will open automatically with the AI-generated changelog entry for you to review and merge.

Note on direct commits: The workflow above opens a PR (not a direct commit), so it also feeds into Release Drafter — two automations working together. 🐇 (◕‿◕✿)


🏁 Script executed:

#!/bin/bash
# Check if there's already a scripts dir in .github
ls .github/ 2>/dev/null

Length of output: 70


@yash-pouranik — confirmed, no scripts/ folder exists yet. Here are the two files to create:


File 1: .github/workflows/weekly-changelog.yml

name: Weekly Mintlify Changelog

on:
  schedule:
    - cron: "0 9 * * 1"  # Every Monday at 9 AM UTC
  workflow_dispatch:       # Manual trigger anytime

permissions:
  contents: write
  pull-requests: write

jobs:
  generate-changelog:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0  # Full history needed for git log

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20"

      - name: Collect last 7 days of merged PRs and commits
        id: collect
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          SINCE=$(date -d '7 days ago' --utc +%Y-%m-%dT%H:%M:%SZ)
          TODAY=$(date --utc +%Y-%m-%d)
          WEEK_START=$(date -d '7 days ago' --utc +%Y-%m-%d)
          echo "today=$TODAY" >> $GITHUB_OUTPUT
          echo "week_start=$WEEK_START" >> $GITHUB_OUTPUT

          gh pr list \
            --repo ${{ github.repository }} \
            --state merged \
            --base main \
            --json number,title,body,labels,mergedAt,author \
            --jq "[.[] | select(.mergedAt >= \"$SINCE\")]" \
            > /tmp/merged_prs.json

          git log --since="7 days ago" --oneline --no-merges > /tmp/commits.txt || true

          git diff --stat "HEAD@{7 days ago}" HEAD -- \
            ':!package-lock.json' ':!*.lock' ':!*.snap' \
            2>/dev/null | tail -20 > /tmp/diff_stat.txt || true

      - name: Generate changelog entry via OpenAI
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
        run: |
          node .github/scripts/generate-changelog-entry.js \
            /tmp/merged_prs.json \
            /tmp/commits.txt \
            /tmp/diff_stat.txt \
            "${{ steps.collect.outputs.today }}" \
            "${{ steps.collect.outputs.week_start }}" \
            > /tmp/new_entry.mdx

          echo "=== Generated entry preview ==="
          cat /tmp/new_entry.mdx

      - name: Prepend entry to current month's changelog file
        run: |
          MONTH=$(date --utc +%B | tr '[:upper:]' '[:lower:]')
          YEAR=$(date --utc +%Y)
          FILE="mintlify/docs/changelog/${MONTH}-${YEAR}.mdx"

          if [ ! -f "$FILE" ]; then
            cat > "$FILE" << EOF
          ---
          title: Changelog ($(date --utc +"%B %Y"))
          description: What's new in urBackend — new features, improvements, and fixes for $(date --utc +"%B").
          ---

          EOF
          fi

          # Insert new entry right after the frontmatter closing ---
          FRONTMATTER_END=$(grep -n "^---$" "$FILE" | sed -n '2p' | cut -d: -f1)
          if [ -z "$FRONTMATTER_END" ]; then
            cat /tmp/new_entry.mdx >> "$FILE"
          else
            {
              head -n "$FRONTMATTER_END" "$FILE"
              echo ""
              cat /tmp/new_entry.mdx
              echo ""
              tail -n +"$((FRONTMATTER_END + 1))" "$FILE"
            } > /tmp/patched.mdx
            mv /tmp/patched.mdx "$FILE"
          fi

          echo "Updated: $FILE"

      - name: Open Pull Request
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          BRANCH="changelog/week-of-${{ steps.collect.outputs.week_start }}"
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]`@users.noreply.github.com`"
          git checkout -b "$BRANCH"
          git add mintlify/docs/changelog/
          git commit -m "docs: weekly changelog update for week of ${{ steps.collect.outputs.week_start }}"
          git push origin "$BRANCH"

          gh pr create \
            --repo ${{ github.repository }} \
            --base main \
            --head "$BRANCH" \
            --title "docs: weekly changelog (week of ${{ steps.collect.outputs.week_start }})" \
            --body "## Weekly Changelog Update

          Auto-generated changelog entry for the week of **${{ steps.collect.outputs.week_start }}** → **${{ steps.collect.outputs.today }}**.

          Please review the AI-generated entries for accuracy before merging.

          > 🤖 Generated by the weekly-changelog workflow. Edit this PR to correct any inaccuracies before merging." \
            --label "documentation"

File 2: .github/scripts/generate-changelog-entry.js

const fs = require("fs");
const https = require("https");

const [, , prsFile, commitsFile, diffStatFile, today, weekStart] =
  process.argv;

const prs = JSON.parse(fs.readFileSync(prsFile, "utf8"));
const commits = fs.readFileSync(commitsFile, "utf8").trim();
const diffStat = fs.readFileSync(diffStatFile, "utf8").trim();

// Nothing merged this week — emit a minimal placeholder
if (!prs.length && !commits) {
  process.stdout.write(
    `<Update label="${today}" description="Week of ${weekStart}${today}" tags={["Improvement"]}>\n\nNo significant changes this week.\n\n</Update>\n`
  );
  process.exit(0);
}

const prSummary = prs
  .map(
    (pr) =>
      `- PR #${pr.number} by @${pr.author?.login ?? "unknown"}: ${pr.title}\n` +
      `  Labels: ${(pr.labels ?? []).map((l) => l.name).join(", ") || "none"}\n` +
      `  ${(pr.body ?? "").slice(0, 400).replace(/\n+/g, " ")}`
  )
  .join("\n\n");

const prompt = `You are a technical writer for urBackend, a Backend-as-a-Service platform (auth, database, storage, mail, webhooks, RLS).

Based on the merged pull requests and git activity below, write a Mintlify changelog entry for the week of ${weekStart} to ${today}.

## Merged PRs:
${prSummary || "None"}

## Recent commits:
${commits || "None"}

## Files changed (summary):
${diffStat || "None"}

## Output rules:
- Output ONLY the raw <Update> MDX block — no explanation, no markdown fences.
- Use this exact structure:

<Update label="${today}" description="Week of ${weekStart}${today}" tags={["Feature", "Improvement", "Fix"]}>
## New features

**Feature name** — User-facing description. [Doc link if obvious]

## Improvements

**Improvement name** — Description.

## Bug fixes

- Fix description.
</Update>

- Only include sections (## New features / ## Improvements / ## Bug fixes) that have actual content.
- Adjust the tags array to only include applicable tags: "Feature", "Improvement", "Fix", "Security".
- Write for developers using the platform, not the internal team.
- Be concise and factual. Do not invent features not evidenced by the input.
- If all changes are internal/infra with no user-visible impact, write a single brief Improvements bullet.`;

const payload = JSON.stringify({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: prompt }],
  max_tokens: 1000,
  temperature: 0.3,
});

const options = {
  hostname: "api.openai.com",
  path: "/v1/chat/completions",
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
    "Content-Length": Buffer.byteLength(payload),
  },
};

const req = https.request(options, (res) => {
  let data = "";
  res.on("data", (chunk) => (data += chunk));
  res.on("end", () => {
    try {
      const response = JSON.parse(data);
      if (response.error) {
        console.error("OpenAI error:", response.error.message);
        process.exit(1);
      }
      process.stdout.write(response.choices[0].message.content.trim() + "\n");
    } catch (e) {
      console.error("Failed to parse OpenAI response:", e.message);
      process.exit(1);
    }
  });
});

req.on("error", (e) => {
  console.error("Request error:", e.message);
  process.exit(1);
});

req.write(payload);
req.end();

Final setup steps

Step Where Action
1 GitHub → Settings → Secrets → Actions Add OPENAI_API_KEY
2 GitHub → Settings → Branches Add branch protection rule on main (require PR)
3 After merging this PR (#184) Test via Actions → Weekly Mintlify Changelog → Run workflow

The workflow opens a PR every Monday for your review — you're never auto-publishing anything. 🐇 (◕‿◕✿)


Failed to handle agent chat message. Please try again.

@yash-pouranik
Copy link
Copy Markdown
Collaborator

@coderabbitai
Bro we dont have openai key and 5dollar
So i suggest using gps-oss-120b @ groq
I hope we will not exceed the token limit.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

@yash-pouranik — great swap! You mean gpt-oss-120b (typo noted 😄), and the Groq model ID is openai/gpt-oss-120b. It's a Mixture-of-Experts architecture with 120B total parameters (5.1B active per forward pass), and has a full 131K context window — more than enough.

Token limit concern? Not at all 🟢

The free tier standard cap is 30 requests/min, 6,000 tokens/min, and 14,400 requests/day per model. The weekly changelog workflow makes exactly 1 API call per week — the prompt (PR titles + commits + diff stat) will be around ~1,500 input tokens and the response ~500 output tokens. You're nowhere near any limit.

No credit card required — just sign up at console.groq.com and you're making API calls within minutes.


Changes needed in the script

The Groq API is OpenAI-compatible, so you can point the OpenAI SDK at Groq's base URL with a one-line change. Here's the updated .github/scripts/generate-changelog-entry.js with the Groq endpoint:

// Change 1: hostname + path
const options = {
  hostname: "api.groq.com",
  path: "/openai/v1/chat/completions",   // ← Groq's OpenAI-compatible endpoint
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.GROQ_API_KEY}`,  // ← GROQ_API_KEY
    "Content-Length": Buffer.byteLength(payload),
  },
};

// Change 2: model name in payload
const payload = JSON.stringify({
  model: "openai/gpt-oss-120b",   // ← Groq model ID
  messages: [{ role: "user", content: prompt }],
  max_tokens: 1000,
  temperature: 0.3,
});

And in .github/workflows/weekly-changelog.yml, update the env var name:

- name: Generate changelog entry via Groq
  env:
    GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}   # ← was OPENAI_API_KEY
  run: |
    node .github/scripts/generate-changelog-entry.js ...

Updated setup checklist

Step Action
1 Sign up at console.groq.com → generate an API key
2 GitHub → Settings → Secrets → Actions → Add GROQ_API_KEY
3 Merge PR #184, then create the two new files with the Groq changes above
4 Test via Actions → Weekly Mintlify Changelog → Run workflow

That's it — completely free, no credit card, and fast inference. 🐇 (◕‿◕✿)

@yash-pouranik
Copy link
Copy Markdown
Collaborator

@Mansi0905
Can u please add this workflow as well??

@yash-pouranik
Copy link
Copy Markdown
Collaborator

@coderabbitai
Mansi will update this and commit, so now can u please update the description of this issue?
#183

@Mansi0905
Copy link
Copy Markdown
Contributor Author

Is this ur tmrw? 🥲

idk man was stdying for exam but my mind was here, so i just appeared again

@yash-pouranik
Copy link
Copy Markdown
Collaborator

Exactly!!
Companies(basic, basic) coming from july, I anyhow have to get any badlyy 😭
So its good u too study
I mean I will merge but. lets study.

@yash-pouranik
Copy link
Copy Markdown
Collaborator

@coderabbitai
Is everything done? as we decided?

@Mansi0905
Copy link
Copy Markdown
Contributor Author

Exactly!! Companies(basic, basic) coming from july, I anyhow have to get any badlyy 😭 So its good u too study I mean I will merge but. lets study.

yeah true that, idk struggling a lot trying my best,

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== .github/release-drafter.yml ==="
cat .github/release-drafter.yml

echo ""
echo "=== .github/workflows/release-drafter.yml ==="
cat .github/workflows/release-drafter.yml

echo ""
echo "=== .github/workflows/weekly-changelog.yml ==="
cat .github/workflows/weekly-changelog.yml 2>/dev/null || echo "FILE NOT FOUND"

echo ""
echo "=== .github/scripts/generate-changelog-entry.js ==="
cat .github/scripts/generate-changelog-entry.js 2>/dev/null || echo "FILE NOT FOUND"

echo ""
echo "=== Repository Labels ==="
gh label list --repo geturbackend/urBackend

echo ""
echo "=== CHANGELOG.md (first 20 lines) ==="
head -20 CHANGELOG.md

Length of output: 8794


@yash-pouranik — Here's the full status check:

✅ All Code/Files — Done

Item Status
CHANGELOG.md (v0.1.0–v0.9.0, Keep a Changelog format) ✅ Done
.github/release-drafter.yml (no emojis, clean labels) ✅ Done
.github/workflows/release-drafter.yml ✅ Done
.github/workflows/weekly-changelog.yml (opens PR, never direct-pushes) ✅ Done
.github/scripts/generate-changelog-entry.js (Groq openai/gpt-oss-120b, 30s timeout) ✅ Done

🔲 Two Things Still Need To Be Done (by you — repo access required)

1. Create 2 missing labelsSettings → Labels → New label

Label Color Purpose
breaking #e11d48 Triggers major version bump
security #7c3aed Populates Security section in release notes

2. Add GROQ_API_KEY to SecretsSettings → Secrets → Actions → New repository secret


⚠️ One Open Question

The weekly changelog workflow currently updates the root CHANGELOG.md, but you originally asked for updates to mintlify/docs/changelog/*.mdx (the <Update> blocks). These are two different things:

  • Root CHANGELOG.md → developer-facing, plain markdown
  • mintlify/docs/*.mdx → public-facing docs site, needs <Update> MDX format

Should the workflow update both, or just one? The Mintlify MDX target was the original ask but the current implementation only does root CHANGELOG.md. Worth clarifying before you merge and test.

🐇 (◕‿◕✿)

@yash-pouranik
Copy link
Copy Markdown
Collaborator

then leave end sems that is joke, just create one more issue and start working.
less go

@yash-pouranik
Copy link
Copy Markdown
Collaborator

@coderabbitai
I have already added those labels

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== Repository Labels ==="
gh label list --repo geturbackend/urBackend

Length of output: 873


@yash-pouranik — I just checked and the breaking and security labels don't appear in the repo yet. It's possible the changes didn't save, or were added to a different repo. Here's the current label list — neither is present.

I can create them for you right now — just say the word and I'll run:

gh label create "breaking" --repo geturbackend/urBackend --color "`#e11d48`" --description "Triggers major version bump"
gh label create "security" --repo geturbackend/urBackend --color "`#7c3aed`" --description "Security-related changes"

Or you can add them manually at Settings → Labels → New label.


Once those two are created, your final merge checklist looks like this:

Item Status
CHANGELOG.md (v0.1.0–v0.9.0) ✅ Done
Release Drafter config + workflow ✅ Done
Weekly Groq changelog workflow + script ✅ Done
Emojis removed from release-drafter ✅ Done
breaking label created 🔲 Pending
security label created 🔲 Pending
GROQ_API_KEY added to GitHub Secrets 🔲 Pending (one-time setup after merge)

Also, the open question from earlier — should the weekly workflow update mintlify/docs/changelog/*.mdx (the <Update> blocks for the docs site), root CHANGELOG.md, or both? The current implementation only updates root CHANGELOG.md. Worth deciding before merging! 🐇

@yash-pouranik
Copy link
Copy Markdown
Collaborator

@coderabbitai
Actually those labels have diff colors, this is why u are not able to get that.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== All Repository Labels ==="
gh label list --repo geturbackend/urBackend --limit 50

Length of output: 1255


@yash-pouranik — confirmed, both labels are there! My bad for the confusion — the color doesn't affect functionality at all.

Updated final pre-merge checklist:

Item Status
CHANGELOG.md (v0.1.0–v0.9.0) ✅ Done
Release Drafter config + workflow (no emojis) ✅ Done
Weekly Groq changelog workflow + script ✅ Done
breaking label ✅ Done (#e8b327)
security label ✅ Done (#7cb26d)
GROQ_API_KEY added to GitHub Secrets 🔲 One-time setup after merge

One open question before merging 👇

The weekly workflow currently writes to root CHANGELOG.md, but the original ask was to update mintlify/docs/changelog/*.mdx (the <Update> MDX blocks on the docs site). Should @Mansi0905 update the target to the Mintlify MDX files, or is updating root CHANGELOG.md also acceptable? Once this is decided, the PR is ready to merge. 🐇

@yash-pouranik
Copy link
Copy Markdown
Collaborator

yash-pouranik commented May 21, 2026

@coderabbitai
I thought roots changelog.md will update on each pr merge? or push? with symntic versioning.
And yes that ai diff should be added with syntax into mintlify/docs/changelog/(april2026.mdx, may2026, june2026 etc)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== .github/workflows/weekly-changelog.yml ==="
cat .github/workflows/weekly-changelog.yml

echo ""
echo "=== .github/scripts/generate-changelog-entry.js ==="
cat .github/scripts/generate-changelog-entry.js

echo ""
echo "=== mintlify/docs/changelog/ — existing files ==="
ls -la mintlify/docs/changelog/ 2>/dev/null || echo "Not found"

echo ""
echo "=== april-2026.mdx first 40 lines (for format reference) ==="
head -40 mintlify/docs/changelog/april-2026.mdx 2>/dev/null || echo "Not found"

Length of output: 9816


@yash-pouranik — Great clarification! Let me clear up a common misconception first, then explain exactly what needs to change.


⚠️ Important: Release Drafter ≠ CHANGELOG.md auto-updater

Automation What it actually does Updates CHANGELOG.md on disk?
Release Drafter Creates/updates a GitHub Draft Release on the Releases page when a PR is merged to main ❌ No — it only writes to GitHub Releases UI
Weekly workflow Runs every Monday, collects 7-day PRs, generates AI summary Should write to Mintlify MDX (currently broken — writes to root CHANGELOG.md)

So the two tracks are:

flowchart LR
    PR[PR merged to main] --> RD[Release Drafter]
    RD --> GHR[GitHub Draft Release\n on Releases page\n with semver tag]

    CRON[Every Monday 9AM] --> WW[Weekly Groq Workflow]
    WW --> MDX[mintlify/docs/changelog/\nmay-2026.mdx\njune-2026.mdx etc.\n with &lt;Update&gt; MDX blocks]
Loading

Root CHANGELOG.md stays as a static historical document (v0.1.0–v0.9.0) — it doesn't auto-update.


What needs to change — 2 files, @Mansi0905

Fix 1: .github/workflows/weekly-changelog.yml

Replace the Prepend entry to CHANGELOG.md step with:

      - name: Prepend entry to current month's Mintlify changelog
        run: |
          MONTH=$(date --utc +%B | tr '[:upper:]' '[:lower:]')
          YEAR=$(date --utc +%Y)
          FILE="mintlify/docs/changelog/${MONTH}-${YEAR}.mdx"

          # Create monthly file if it doesn't exist yet
          if [ ! -f "$FILE" ]; then
            cat > "$FILE" << EOF
---
title: Changelog
description: What's new in urBackend — new features, improvements, and fixes.
---

EOF
          fi

          # Insert new <Update> entry right after the closing --- of frontmatter
          FRONTMATTER_END=$(grep -n "^---$" "$FILE" | sed -n '2p' | cut -d: -f1)
          if [ -z "$FRONTMATTER_END" ]; then
            cat changelog_entry.md >> "$FILE"
          else
            {
              head -n "$FRONTMATTER_END" "$FILE"
              echo ""
              cat changelog_entry.md
              echo ""
              tail -n +"$((FRONTMATTER_END + 1))" "$FILE"
            } > /tmp/patched.mdx
            mv /tmp/patched.mdx "$FILE"
          fi

          echo "Updated: $FILE"

      - name: Open Pull Request
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          BRANCH="changelog/week-of-$(date +%Y-%m-%d)"
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]`@users.noreply.github.com`"
          git checkout -b "$BRANCH"
          git add mintlify/docs/changelog/    # ← was CHANGELOG.md
          git diff --staged --quiet && echo "No changes to commit" && exit 0
          git commit -m "docs: weekly changelog update $(date +%Y-%m-%d)"
          git push origin "$BRANCH"
          gh pr create \
            --repo ${{ github.repository }} \
            --base main \
            --head "$BRANCH" \
            --title "docs: weekly changelog update $(date +%Y-%m-%d)" \
            --body "Auto-generated weekly changelog entry. Please review before merging." \
            --label "documentation"

Fix 2: .github/scripts/generate-changelog-entry.js

The AI prompt needs to output <Update> MDX format (matching april-2026.mdx) instead of ### Added / ### Fixed markdown. Replace the prompt variable with:

const TODAY = new Date().toISOString().slice(0, 10);
const WEEK_START = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)
  .toISOString()
  .slice(0, 10);

const prompt = `You are a technical writer for urBackend, an open-source Backend-as-a-Service platform (auth, database, storage, mail, webhooks, RLS).

Based on the following merged pull requests from the last 7 days, write a Mintlify changelog <Update> entry.

Merged PRs (${prCount} total):
${prSummary}

Output ONLY the raw <Update> MDX block — no explanation, no markdown fences.
Use this exact format (matching the existing changelog style):

<Update label="${TODAY}" description="Week of ${WEEK_START}${TODAY}" tags={["Feature", "Improvement", "Fix"]}>
## New features

**Feature name** — User-facing description. [Doc link if obvious]

## Improvements

**Improvement name** — Description.

## Bug fixes

- Fix description (`#PR_NUMBER`)
</Update>

Rules:
- Only include sections (## New features / ## Improvements / ## Bug fixes) that have actual content.
- Adjust the tags array to only include applicable tags from: "Feature", "Improvement", "Fix", "Security".
- Write for developers using the platform, not the internal team.
- Be concise and factual. Do not invent features not evidenced by the PRs.
- If no PRs were merged, output a minimal entry: No significant changes this week.`;

Summary for @Mansi0905

File Change
.github/workflows/weekly-changelog.yml Change target from CHANGELOG.mdmintlify/docs/changelog/{month}-{year}.mdx; update git add path
.github/scripts/generate-changelog-entry.js Update AI prompt to output <Update> MDX format instead of ### Added / ### Fixed markdown

Once those two changes are committed, the full picture is:

  • ✅ PR merged → Release Drafter → GitHub Draft Release (semantic version)
  • ✅ Every Monday → Groq AI → <Update> block prepended to current month's MDX → PR opened for review

🐇 (◕‿◕✿)

@yash-pouranik
Copy link
Copy Markdown
Collaborator

@Mansi0905

Copy link
Copy Markdown
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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/scripts/generate-changelog-entry.js (1)

66-96: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Check res.statusCode before parsing the body.

Currently a non-2xx response is only detected if Groq returns a well-formed JSON body containing response.error. For HTTP-layer failures (e.g., 429 rate limit with a plain-text body, 502/504 from an upstream proxy returning HTML) you fall through to the JSON.parse catch with a generic "Failed to parse response" message. Inspecting res.statusCode first gives clearer diagnostics and lets you treat retryable failures distinctly if you ever add retry/backoff.

♻️ Proposed fix
 const req = https.request(options, (res) => {
   let data = "";

   res.on("data", (chunk) => {
     data += chunk;
   });

   res.on("end", () => {
+    if (res.statusCode < 200 || res.statusCode >= 300) {
+      console.error(`Groq API returned HTTP ${res.statusCode}`);
+      console.error("Raw response:", data);
+      process.exit(1);
+    }
     try {
       const response = JSON.parse(data);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/generate-changelog-entry.js around lines 66 - 96, Inside the
https.request response handler (the callback using res and inside
res.on("end")), check res.statusCode before attempting JSON.parse: if statusCode
is not in the 2xx range, log a clear error including the HTTP status code,
status message and the raw body (data), and exit non‑zero (or handle retryable
codes like 429/502/503/504 specially if you later add backoff); only call
JSON.parse(data) when res.statusCode indicates success. This change should be
applied around the existing res.on("end") block that currently does JSON.parse
and references response.error and response.choices.
🧹 Nitpick comments (3)
.github/workflows/weekly-changelog.yml (2)

84-97: 💤 Low value

Frontmatter detection assumes the second --- is the frontmatter terminator.

grep -n "^---$" | sed -n '2p' picks the 2nd --- line in the file. That is correct for a fresh MDX, but if a human ever adds an MDX horizontal rule (--- on its own line) above existing <Update> entries, the insertion point shifts into the body and corrupts content. A more robust approach is to find the second --- only within the leading frontmatter block (e.g., bail if line 1 isn't ---, then locate the next ---).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/weekly-changelog.yml around lines 84 - 97, The current
FRONTMATTER_END logic assumes the second "---" anywhere is the frontmatter end;
update the detection so it first verifies the file starts with "---" (line 1)
and only then searches for the next "---" after line 1 to set FRONTMATTER_END
(instead of using grep ... | sed -n '2p'); change the code that builds
/tmp/patched.mdx to use this new FRONTMATTER_END and fall back to appending
changelog_entry.mdx when the file doesn't start with a frontmatter delimiter or
no terminating "---" is found.

67-71: 💤 Low value

Use UTC consistently for date-derived names.

Line 69-70 correctly uses date --utc to pick the monthly file, but lines 105, 111, 117 use date without --utc. On ubuntu-latest the system clock is already UTC so this currently behaves the same, but it's a latent inconsistency that could surface if the runner image changes or if you switch to a self-hosted runner. Worth aligning to avoid the file name and PR title disagreeing across midnight.

Also applies to: 105-117

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/weekly-changelog.yml around lines 67 - 71, The workflow
uses date --utc for MONTH and YEAR when building FILE but other date invocations
(used to build the changelog filename and PR title later) omit --utc; update
every date command that derives names/titles to include --utc (e.g., the MONTH,
YEAR, and any DATE or variables used to construct FILE and the PR title/branch)
so all name-based date calculations use date --utc consistently (look for usages
of the variables FILE, MONTH, YEAR, DATE, and any PR title/branch construction
in this workflow and add --utc to their date calls).
.github/scripts/generate-changelog-entry.js (1)

89-89: ⚡ Quick win

Defensively strip code fences from the model output.

The prompt tells the model to emit raw MDX with "no markdown fences", but LLMs occasionally wrap output in ```mdx ... ``` regardless. Since content.trim() is written straight into a .mdx file that Mintlify will render, an accidental fence will break the rendered page. A small replace(/^```\w*\n?|\n?```$/g, '') before writing is cheap insurance.

♻️ Proposed fix
-      process.stdout.write(content.trim());
+      const cleaned = content
+        .trim()
+        .replace(/^```(?:mdx|md)?\s*\n?/, "")
+        .replace(/\n?```$/, "");
+      process.stdout.write(cleaned);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/generate-changelog-entry.js at line 89, The code currently
writes content.trim() directly via process.stdout.write(content.trim()); to the
.mdx output; update the write step to defensively strip optional Markdown/M DX
code fences from the model output by creating a cleaned string from content
(e.g., const cleaned =
content.trim().replace(/(^```(?:mdx|md)?\s*\n?)|(\n?```$)/g, "");) and then call
process.stdout.write(cleaned) instead of writing content.trim(); this ensures
any accidental surrounding ``` fences are removed before output.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/weekly-changelog.yml:
- Around line 105-112: The branch name BRANCH="changelog/week-of-$(date
+%Y-%m-%d)" is deterministic and will cause git checkout -b "$BRANCH" or git
push origin "$BRANCH" to fail on same-day re-runs; update the workflow to make
BRANCH unique per run (e.g., append a timestamp or GITHUB_RUN_ID) or change the
git commands to be idempotent by using git checkout -B "$BRANCH" (replace
existing local branch) and git push --force-with-lease origin "$BRANCH" (safe
update if remote exists) so repeated executions succeed; apply this change to
the BRANCH assignment and the git checkout/git push steps referenced above.

---

Outside diff comments:
In @.github/scripts/generate-changelog-entry.js:
- Around line 66-96: Inside the https.request response handler (the callback
using res and inside res.on("end")), check res.statusCode before attempting
JSON.parse: if statusCode is not in the 2xx range, log a clear error including
the HTTP status code, status message and the raw body (data), and exit non‑zero
(or handle retryable codes like 429/502/503/504 specially if you later add
backoff); only call JSON.parse(data) when res.statusCode indicates success. This
change should be applied around the existing res.on("end") block that currently
does JSON.parse and references response.error and response.choices.

---

Nitpick comments:
In @.github/scripts/generate-changelog-entry.js:
- Line 89: The code currently writes content.trim() directly via
process.stdout.write(content.trim()); to the .mdx output; update the write step
to defensively strip optional Markdown/M DX code fences from the model output by
creating a cleaned string from content (e.g., const cleaned =
content.trim().replace(/(^```(?:mdx|md)?\s*\n?)|(\n?```$)/g, "");) and then call
process.stdout.write(cleaned) instead of writing content.trim(); this ensures
any accidental surrounding ``` fences are removed before output.

In @.github/workflows/weekly-changelog.yml:
- Around line 84-97: The current FRONTMATTER_END logic assumes the second "---"
anywhere is the frontmatter end; update the detection so it first verifies the
file starts with "---" (line 1) and only then searches for the next "---" after
line 1 to set FRONTMATTER_END (instead of using grep ... | sed -n '2p'); change
the code that builds /tmp/patched.mdx to use this new FRONTMATTER_END and fall
back to appending changelog_entry.mdx when the file doesn't start with a
frontmatter delimiter or no terminating "---" is found.
- Around line 67-71: The workflow uses date --utc for MONTH and YEAR when
building FILE but other date invocations (used to build the changelog filename
and PR title later) omit --utc; update every date command that derives
names/titles to include --utc (e.g., the MONTH, YEAR, and any DATE or variables
used to construct FILE and the PR title/branch) so all name-based date
calculations use date --utc consistently (look for usages of the variables FILE,
MONTH, YEAR, DATE, and any PR title/branch construction in this workflow and add
--utc to their date calls).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b37062b9-5e44-443a-aa97-faf259cfba67

📥 Commits

Reviewing files that changed from the base of the PR and between e2c6250 and e839bf1.

📒 Files selected for processing (2)
  • .github/scripts/generate-changelog-entry.js
  • .github/workflows/weekly-changelog.yml

Comment thread .github/workflows/weekly-changelog.yml Outdated
@yash-pouranik
Copy link
Copy Markdown
Collaborator

is everything as plan? @coderabbitai ?

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== .github/workflows/weekly-changelog.yml ==="
cat .github/workflows/weekly-changelog.yml 2>/dev/null || echo "FILE NOT FOUND"

echo ""
echo "=== .github/scripts/generate-changelog-entry.js ==="
cat .github/scripts/generate-changelog-entry.js 2>/dev/null || echo "FILE NOT FOUND"

echo ""
echo "=== .github/release-drafter.yml ==="
cat .github/release-drafter.yml 2>/dev/null || echo "FILE NOT FOUND"

echo ""
echo "=== .github/workflows/release-drafter.yml ==="
cat .github/workflows/release-drafter.yml 2>/dev/null || echo "FILE NOT FOUND"

echo ""
echo "=== Repository Labels ==="
gh label list --repo geturbackend/urBackend --limit 50

echo ""
echo "=== CHANGELOG.md (first 20 lines) ==="
head -20 CHANGELOG.md 2>/dev/null || echo "FILE NOT FOUND"

Length of output: 10460


@yash-pouranik — Yes, everything is exactly as planned! ✅ Here's the final verified state:

Item Status
CHANGELOG.md (v0.1.0–v0.9.0, Keep a Changelog) ✅ Done
.github/release-drafter.yml (no emojis, correct labels) ✅ Done
.github/workflows/release-drafter.yml (contents: write) ✅ Done
breaking label ✅ Exists (#e8b327)
security label ✅ Exists (#7cb26d)
.github/workflows/weekly-changelog.yml → writes to mintlify/docs/changelog/{month}-{year}.mdx, opens PR ✅ Done
.github/scripts/generate-changelog-entry.js → Groq openai/gpt-oss-120b, <Update> MDX output, 30s timeout, fail-fast guard ✅ Done
GROQ_API_KEY in GitHub Secrets 🔲 One-time manual step — needs to be added by you at Settings → Secrets → Actions

How it all works post-merge:

flowchart LR
    A[PR merged to main] --> B[Release Drafter workflow]
    B --> C[GitHub Draft Release\nupdated with semver tag]

    D[Every Monday 9AM UTC] --> E[Weekly Mintlify Changelog workflow]
    E --> F[Groq openai/gpt-oss-120b\ngenerates Update MDX block]
    F --> G[Prepended to mintlify/docs/changelog/\nmay-2026.mdx, june-2026.mdx etc.]
    G --> H[PR opened for your review\nnever auto-merges]
Loading

You're good to merge — just add GROQ_API_KEY to Secrets and test the weekly workflow manually via Actions → Weekly Mintlify Changelog → Run workflow after merging. 🐇 (◕‿◕✿)

@yash-pouranik
Copy link
Copy Markdown
Collaborator

I hope these workflows will not run on PR? @coderabbitai >

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== release-drafter.yml triggers ==="
grep -A 10 "^on:" .github/workflows/release-drafter.yml

echo ""
echo "=== weekly-changelog.yml triggers ==="
grep -A 10 "^on:" .github/workflows/weekly-changelog.yml

Length of output: 414


@yash-pouranik — Confirmed, neither workflow will trigger on a PR event:

Workflow Triggers
release-drafter.yml push to main / master only
weekly-changelog.yml schedule (Mondays 9AM UTC) + workflow_dispatch (manual) only

Neither has a pull_request trigger, so opening, updating, or syncing any PR won't fire either of them. ✅

The only thing that kicks off Release Drafter is an actual merge (push) to main — which is exactly the intended behaviour. 🐇 (◕‿◕✿)

@yash-pouranik yash-pouranik merged commit 27c9950 into geturbackend:main May 21, 2026
8 checks passed
@yash-pouranik
Copy link
Copy Markdown
Collaborator

yash-pouranik commented May 21, 2026

@Mansi0905
OK thank you for the PR, and cooperating so nicely
Hope to see more contributions in near future.
All the best.
Just updating labels.
Please leave start on repo :).

@Mansi0905
Copy link
Copy Markdown
Contributor Author

@Mansi0905 OK thank you for the PR, and cooperating so nicely Hope to see more contributions in near future. All the best. Just updating labels. Please leave start on repo :).

thank you for the patience and helping me

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] Add CHANGELOG.md to track release history

2 participants