Skip to content

feat(ci): auto-generate loading tips from release metadata#1044

Merged
jeremyeder merged 4 commits intomainfrom
feat/auto-loading-tips
Apr 10, 2026
Merged

feat(ci): auto-generate loading tips from release metadata#1044
jeremyeder merged 4 commits intomainfrom
feat/auto-loading-tips

Conversation

@jeremyeder
Copy link
Copy Markdown
Contributor

@jeremyeder jeremyeder commented Mar 26, 2026

Summary

  • Adds scripts/generate-loading-tips.py that generates dynamic loading tips from git history
  • Integrates into the release pipeline between changelog generation and tag creation
  • Tips highlight first-time contributors and top 3 commits by lines of code added

Example output (v0.1.0)

  1. Welcome Aidan Reilly, who made their first contribution in v0.1.0!
  2. New in v0.1.0: fix technical inaccuracies and add undocumented feature coverage (+926 lines)
  3. New in v0.1.0: git credential helper for proper repo authentication (+276 lines)
  4. New in v0.1.0: [Amber] Fix: Bug: Loading custom workflow from private GitHub repo downloads no files (+150 lines)

Test plan

  • Run python3 scripts/generate-loading-tips.py v0.1.0 v0.0.35 ambient-code/platform /tmp/test.ts locally
  • Verify generated TypeScript is valid
  • Trigger a test release to confirm pipeline integration

Summary by CodeRabbit

  • New Features
    • Loading tips are now dynamically generated for each release, automatically highlighting first-time contributors and featuring top commits from the latest release.

Add a Python script that runs during the release pipeline to generate
dynamic loading tips highlighting first-time contributors and the top 3
commits by lines of code added. Tips are written into loading-tips.ts
and included in the frontend build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

📝 Walkthrough

Walkthrough

Adds release workflow step to generate frontend loading tips from commit history and conditionally commit the updated TypeScript file to git.

Changes

Cohort / File(s) Summary
Release Workflow
.github/workflows/prod-release-deploy.yaml
Inserts "Generate Loading Tips" step after changelog generation. Invokes Python script with computed latest_tag and new_tag, conditionally commits generated file with GitHub Actions bot identity if changes exist.
Loading Tips Generator
scripts/generate-loading-tips.py
New script that extracts first-time contributors and top commits (ranked by lines added) from git history post-latest_tag. Generates TypeScript file exporting RELEASE_TIPS array (capped at 10 by default) merged with static tips.
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title follows Conventional Commits format with correct type (feat) and scope (ci), accurately describing the main change: auto-generating loading tips from release metadata.
Performance And Algorithmic Complexity ✅ Passed PR introduces no meaningful performance regressions; O(n log n) sorting on small datasets, sequential git commands, runs only during release pipeline.
Security And Secret Handling ✅ Passed No hardcoded secrets, safe subprocess usage, proper output escaping, and hardcoded output path eliminate injection and path traversal risks.
Kubernetes Resource Safety ✅ Passed PR modifies only GitHub Actions workflow and Python script; no Kubernetes manifests are altered.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/auto-loading-tips
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/auto-loading-tips

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

@jeremyeder jeremyeder marked this pull request as ready for review April 10, 2026 18:13
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 (2)
.github/workflows/prod-release-deploy.yaml (2)

40-40: ⚠️ Potential issue | 🟠 Major

Actions should be pinned to SHA for supply chain security.

Multiple actions use mutable version tags (@v6, @v3, @v7, etc.) instead of commit SHAs. This applies to actions/checkout, docker/setup-buildx-action, docker/login-action, docker/build-push-action, rickstaa/action-create-tag, softprops/action-gh-release, redhat-actions/oc-installer, and imranismail/setup-kustomize.

Pin to full SHA, e.g.:

uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

As per coding guidelines: "Pin action versions to SHA."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/prod-release-deploy.yaml at line 40, The workflow uses
mutable action tags (e.g. actions/checkout@v6, docker/setup-buildx-action@v3,
docker/login-action@v3, docker/build-push-action@v4,
rickstaa/action-create-tag@v2, softprops/action-gh-release@v1,
redhat-actions/oc-installer@v3, imranismail/setup-kustomize@v1) which must be
pinned to full commit SHAs for supply-chain security; update each uses: entry to
reference the corresponding action's full commit SHA (replace the `@vX` tags with
the specific SHA), optionally add a comment with the original tag for clarity,
and verify each SHA matches the intended release before committing.

173-201: ⚠️ Potential issue | 🔴 Critical

Local commit with loading tips is not pushed before tag creation.

The step commits loading-tips.ts locally (lines 189-192) but never pushes. The subsequent action-create-tag creates the tag on the remote's current HEAD, which doesn't include this commit. The build job (line 290) checks out the tag, so the frontend image will be built without the updated loading tips.

Either push the commit before tagging, or create the tag locally after the commit and then push both:

Proposed fix
           git commit -m "chore(frontend): update loading tips for ${NEW_TAG}

          Auto-generated release tips highlighting contributors and changes."
          fi

+     - name: Push loading tips commit
+       run: |
+         git push origin HEAD:${{ github.ref_name }}

      - name: Create Tag
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/prod-release-deploy.yaml around lines 173 - 201, The
"Generate Loading Tips" step currently commits changes to OUTPUT
(components/frontend/src/lib/loading-tips.ts) but never pushes them, so the
subsequent "Create Tag" action (rickstaa/action-create-tag@v1) will tag the
remote HEAD without the new commit; update the workflow to, after git commit in
the "Generate Loading Tips" step, run git push origin HEAD to push the commit
(or alternatively create the tag locally using git tag and then push both with
git push origin HEAD --tags) before the "Create Tag" step so the created tag
includes the committed loading-tips changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/generate-loading-tips.py`:
- Around line 140-156: The function write_loading_tips_ts currently emits a
stray comma when tips is empty, producing invalid TypeScript; update it to only
render array elements when there are entries by constructing a combined list of
entries from the generated tips and STATIC_TIPS (both properly escaped) and then
joining that list with ",\n" into a single variable (e.g. entries_lines); when
the combined list is empty emit an empty array literal without a stray comma.
Locate write_loading_tips_ts and replace the separate release_lines/static_lines
logic with this single combined entries list so the generated export const
RELEASE_TIPS: string[] = [ ... ] is always syntactically valid.

---

Outside diff comments:
In @.github/workflows/prod-release-deploy.yaml:
- Line 40: The workflow uses mutable action tags (e.g. actions/checkout@v6,
docker/setup-buildx-action@v3, docker/login-action@v3,
docker/build-push-action@v4, rickstaa/action-create-tag@v2,
softprops/action-gh-release@v1, redhat-actions/oc-installer@v3,
imranismail/setup-kustomize@v1) which must be pinned to full commit SHAs for
supply-chain security; update each uses: entry to reference the corresponding
action's full commit SHA (replace the `@vX` tags with the specific SHA),
optionally add a comment with the original tag for clarity, and verify each SHA
matches the intended release before committing.
- Around line 173-201: The "Generate Loading Tips" step currently commits
changes to OUTPUT (components/frontend/src/lib/loading-tips.ts) but never pushes
them, so the subsequent "Create Tag" action (rickstaa/action-create-tag@v1) will
tag the remote HEAD without the new commit; update the workflow to, after git
commit in the "Generate Loading Tips" step, run git push origin HEAD to push the
commit (or alternatively create the tag locally using git tag and then push both
with git push origin HEAD --tags) before the "Create Tag" step so the created
tag includes the committed loading-tips changes.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6b3ccccd-2b29-4b61-9a6f-a1f5e958fc23

📥 Commits

Reviewing files that changed from the base of the PR and between dc1f42e and c0a53eb.

📒 Files selected for processing (2)
  • .github/workflows/prod-release-deploy.yaml
  • scripts/generate-loading-tips.py

Comment on lines +140 to +156
def write_loading_tips_ts(tips: list[str], output_path: str):
escaped = [t.replace("\\", "\\\\").replace('"', '\\"') for t in tips]
release_lines = ",\n".join(f' "{t}"' for t in escaped)

static_lines = ",\n".join(f' "{t}"' for t in STATIC_TIPS)

content = (
"/**\n"
" * Release-generated loading tips for the Ambient Code platform.\n"
" * Auto-generated by scripts/generate-loading-tips.py during the release pipeline.\n"
" * These tips highlight recent changes, contributors, and platform milestones.\n"
" *\n"
" * DO NOT EDIT MANUALLY — this array is regenerated on every release.\n"
" */\n"
"export const RELEASE_TIPS: string[] = [\n"
f"{release_lines},\n"
"];\n"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Invalid TypeScript when no release tips are generated.

If tips is empty, release_lines becomes an empty string, producing:

export const RELEASE_TIPS: string[] = [
,
];

This is a syntax error that will break the frontend build.

Proposed fix
 def write_loading_tips_ts(tips: list[str], output_path: str):
     escaped = [t.replace("\\", "\\\\").replace('"', '\\"') for t in tips]
-    release_lines = ",\n".join(f'  "{t}"' for t in escaped)
+    release_lines = ",\n".join(f'  "{t}"' for t in escaped) + "," if escaped else ""
 
     static_lines = ",\n".join(f'  "{t}"' for t in STATIC_TIPS)
 
     content = (
         "/**\n"
         " * Release-generated loading tips for the Ambient Code platform.\n"
         " * Auto-generated by scripts/generate-loading-tips.py during the release pipeline.\n"
         " * These tips highlight recent changes, contributors, and platform milestones.\n"
         " *\n"
         " * DO NOT EDIT MANUALLY — this array is regenerated on every release.\n"
         " */\n"
         "export const RELEASE_TIPS: string[] = [\n"
-        f"{release_lines},\n"
+        f"{release_lines}\n"
         "];\n"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/generate-loading-tips.py` around lines 140 - 156, The function
write_loading_tips_ts currently emits a stray comma when tips is empty,
producing invalid TypeScript; update it to only render array elements when there
are entries by constructing a combined list of entries from the generated tips
and STATIC_TIPS (both properly escaped) and then joining that list with ",\n"
into a single variable (e.g. entries_lines); when the combined list is empty
emit an empty array literal without a stray comma. Locate write_loading_tips_ts
and replace the separate release_lines/static_lines logic with this single
combined entries list so the generated export const RELEASE_TIPS: string[] = [
... ] is always syntactically valid.

@jeremyeder jeremyeder enabled auto-merge (squash) April 10, 2026 18:20
@jeremyeder jeremyeder disabled auto-merge April 10, 2026 18:20
@jeremyeder jeremyeder merged commit 5768e12 into main Apr 10, 2026
11 checks passed
@jeremyeder jeremyeder deleted the feat/auto-loading-tips branch April 10, 2026 18:20
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