feat(ci): auto-generate loading tips from release metadata#1044
feat(ci): auto-generate loading tips from release metadata#1044jeremyeder merged 4 commits intomainfrom
Conversation
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>
📝 WalkthroughWalkthroughAdds release workflow step to generate frontend loading tips from commit history and conditionally commit the updated TypeScript file to git. Changes
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
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 | 🟠 MajorActions 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 toactions/checkout,docker/setup-buildx-action,docker/login-action,docker/build-push-action,rickstaa/action-create-tag,softprops/action-gh-release,redhat-actions/oc-installer, andimranismail/setup-kustomize.Pin to full SHA, e.g.:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2As 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 | 🔴 CriticalLocal commit with loading tips is not pushed before tag creation.
The step commits
loading-tips.tslocally (lines 189-192) but never pushes. The subsequentaction-create-tagcreates 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
📒 Files selected for processing (2)
.github/workflows/prod-release-deploy.yamlscripts/generate-loading-tips.py
| 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" |
There was a problem hiding this comment.
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.
Summary
scripts/generate-loading-tips.pythat generates dynamic loading tips from git historyExample output (v0.1.0)
Test plan
python3 scripts/generate-loading-tips.py v0.1.0 v0.0.35 ambient-code/platform /tmp/test.tslocallySummary by CodeRabbit