Skip to content

[CI] Add Release gh action - #181

Merged
Avni2000 merged 1 commit into
mainfrom
auto-package-management
Mar 20, 2026
Merged

Avni2000 merged 1 commit into
mainfrom
auto-package-management

Conversation

@Avni2000

@Avni2000 Avni2000 commented Mar 20, 2026 •

Copy link
Copy Markdown
Owner
  • updates semver from package.json
  • writes simple git oneline changelog for release notes
  • set default to updating minor, instead of patch as we've been doing

Summary by CodeRabbit

  • Chores
    • Implemented automated release workflow to streamline versioning, release notes generation, and extension packaging.

- updates semver from package.json
- writes simple git oneline changelog for release notes
- set default to updating minor, instead of patch as we've been doing
@coderabbitai

coderabbitai Bot commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

A new GitHub Actions workflow has been added that automates the release process. It bumps the npm package version, generates release notes from git history, creates git tags, publishes to GitHub Releases, and packages the VS Code extension artifact.

Changes

Cohort / File(s) Summary
Release Workflow
.github/workflows/release.yml
New 96-line workflow triggered via manual workflow_dispatch. Performs version bumping with npm version, generates RELEASE_NOTES.md from git log, commits changes, creates git tags, and publishes GitHub Releases with VS Code extension package artifact.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A workflow so fine, now release time's a breeze,
Versions bump and notes flow with such ease,
Tags dance through the git, artifacts take flight,
GitHub Releases bloom in the moonlight! ✨
Automation's sweet magic, the release flows right!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[CI] Add Release gh action' directly describes the main change: adding a GitHub Actions workflow for releases. It is concise, specific, and clearly summarizes the primary modification.
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
  • Commit unit tests in branch auto-package-management

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.

@Avni2000
Avni2000 enabled auto-merge March 20, 2026 20:22

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🧹 Nitpick comments (3)
.github/workflows/release.yml (3)

16-21: Serialize release runs.

This workflow mutates shared repo state. Without a concurrency group, two manual dispatches can race and both try to cut the same next version/tag.

🧭 Suggested concurrency guard
 permissions:
   contents: write

+concurrency:
+  group: release-${{ github.ref }}
+  cancel-in-progress: false
+
 jobs:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yml around lines 16 - 21, The release job can race
when multiple manual dispatches run; add a concurrency guard under the release
job to serialize runs. Update the jobs.release configuration to include a
concurrency block with a fixed group name (e.g., "release") and set
cancel-in-progress: false so only one release runs at a time and subsequent runs
wait; target the concurrency block for the existing "release" job to prevent
simultaneous tag/version mutations.

55-56: Remove the extra lockfile step.

npm version already writes the new version to package.json and package-lock.json. Running npm install --package-lock-only again adds a second lockfile-generation path for no functional gain and opens the door to unnecessary lockfile churn. (docs.npmjs.com)

♻️ Proposed simplification
-      - name: Update package-lock.json
-        run: npm install --package-lock-only
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yml around lines 55 - 56, Remove the redundant
GitHub Actions step that runs "npm install --package-lock-only" (the step named
"Update package-lock.json"); since "npm version" already updates
package-lock.json, delete the step invoking npm install --package-lock-only to
avoid duplicate lockfile generation and churn.

24-32: Pin Actions to immutable SHAs.

actions/checkout@v6 and actions/setup-node@v6 are movable tags. GitHub documents full commit SHAs as the only immutable reference and notes that repo/org policies can require SHA-pinned Actions, so this can drift or get blocked later. (docs.github.com)

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

In @.github/workflows/release.yml around lines 24 - 32, The workflow uses
movable tags for third-party actions (the steps named "Checkout" and "Setup
Node.js" referencing actions/checkout@v6 and actions/setup-node@v6); replace
those version tags with the corresponding immutable commit SHAs for each action
(obtain the full commit SHA from the action's GitHub repository or the
Marketplace and use e.g. actions/checkout@<full-sha> and
actions/setup-node@<full-sha>) so the workflow is pinned to an immutable
reference and cannot drift or be blocked by org policies.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/release.yml:
- Around line 77-86: The workflow currently commits/tags/pushes in the "Commit
and tag" step before running the "Build .vsix" step which triggers the
package.json "vscode:prepublish" hook (npm run package); reorder the steps so
the packaging (npx `@vscode/vsce` package) runs and succeeds before creating the
git commit/tag/push, and ensure the commit/tag step only runs if the build step
succeeded (fail the job on build errors) so a version/tag is never pushed
without a successful .vsix build.
- Around line 3-14: The workflow currently allows manual triggers from any
branch; add a branch guard so mutating actions only run on main by checking the
ref. In the .github/workflows/release.yml workflow_dispatch setup keep as-is but
add an if condition on the job or the specific mutating steps (the steps that
perform commit/tag/push — the "Commit version", "Create tag", "Push changes"
steps referenced in the diff) such as if: github.ref == 'refs/heads/main' (or at
job level: if: github.ref == 'refs/heads/main') so these steps are skipped
unless the run is on main; ensure the same guard covers tagging and pushing
steps to prevent accidental releases from feature branches.

---

Nitpick comments:
In @.github/workflows/release.yml:
- Around line 16-21: The release job can race when multiple manual dispatches
run; add a concurrency guard under the release job to serialize runs. Update the
jobs.release configuration to include a concurrency block with a fixed group
name (e.g., "release") and set cancel-in-progress: false so only one release
runs at a time and subsequent runs wait; target the concurrency block for the
existing "release" job to prevent simultaneous tag/version mutations.
- Around line 55-56: Remove the redundant GitHub Actions step that runs "npm
install --package-lock-only" (the step named "Update package-lock.json"); since
"npm version" already updates package-lock.json, delete the step invoking npm
install --package-lock-only to avoid duplicate lockfile generation and churn.
- Around line 24-32: The workflow uses movable tags for third-party actions (the
steps named "Checkout" and "Setup Node.js" referencing actions/checkout@v6 and
actions/setup-node@v6); replace those version tags with the corresponding
immutable commit SHAs for each action (obtain the full commit SHA from the
action's GitHub repository or the Marketplace and use e.g.
actions/checkout@<full-sha> and actions/setup-node@<full-sha>) so the workflow
is pinned to an immutable reference and cannot drift or be blocked by org
policies.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: db37a650-1044-44f1-af04-568408f8e8c3

📥 Commits

Reviewing files that changed from the base of the PR and between 7031d11 and c5ca01a.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

Comment on lines +3 to +14
on:
workflow_dispatch:
inputs:
bump:
description: "Version bump type"
required: true
default: "minor"
type: choice
options:
- patch
- minor
- major

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

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/release.yml

Repository: Avni2000/MergeNB

Length of output: 3363


Restrict manual releases to the main branch.

The workflow_dispatch trigger has no branch restriction, allowing any branch to be released. Since the workflow commits, tags, and pushes (lines 77–83) before building and creating a release, an operator can inadvertently bump the version and publish from a feature branch. Add a guard to enforce main before any mutating step.

🔒 Proposed guard
 jobs:
   release:
     runs-on: ubuntu-latest

     steps:
+      - name: Enforce release branch
+        run: |
+          test "${GITHUB_REF}" = "refs/heads/main" || {
+            echo "Releases must run from main, got ${GITHUB_REF}" >&2
+            exit 1
+          }
+
       - name: Checkout
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yml around lines 3 - 14, The workflow currently
allows manual triggers from any branch; add a branch guard so mutating actions
only run on main by checking the ref. In the .github/workflows/release.yml
workflow_dispatch setup keep as-is but add an if condition on the job or the
specific mutating steps (the steps that perform commit/tag/push — the "Commit
version", "Create tag", "Push changes" steps referenced in the diff) such as if:
github.ref == 'refs/heads/main' (or at job level: if: github.ref ==
'refs/heads/main') so these steps are skipped unless the run is on main; ensure
the same guard covers tagging and pushing steps to prevent accidental releases
from feature branches.

Comment on lines +77 to +86
- name: Commit and tag
run: |
VERSION="${{ steps.version.outputs.version }}"
git add package.json package-lock.json
git commit -m "Release v${VERSION}"
git tag "${VERSION}"
git push origin HEAD --follow-tags

- name: Build .vsix
run: npx @vscode/vsce package

@coderabbitai coderabbitai Bot Mar 20, 2026 •

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

Build the VSIX before pushing the tag.

Line 86 isn't just packaging: package.json:128-135 wires vscode:prepublish to npm run package, so lint, type-checking, and the production esbuild run happen after Lines 77-83 have already pushed the release commit and tag. If that build fails, the repo is left half-released with a new version/tag but no .vsix or GitHub Release.

🔁 Safer ordering
-      - name: Commit and tag
-        run: |
-          VERSION="${{ steps.version.outputs.version }}"
-          git add package.json package-lock.json
-          git commit -m "Release v${VERSION}"
-          git tag "${VERSION}"
-          git push origin HEAD --follow-tags
-
       - name: Build .vsix
         run: npx `@vscode/vsce` package
+
+      - name: Commit and tag
+        run: |
+          VERSION="${{ steps.version.outputs.version }}"
+          git add package.json package-lock.json
+          git commit -m "Release v${VERSION}"
+          git tag "${VERSION}"
+          git push origin HEAD --follow-tags
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yml around lines 77 - 86, The workflow currently
commits/tags/pushes in the "Commit and tag" step before running the "Build
.vsix" step which triggers the package.json "vscode:prepublish" hook (npm run
package); reorder the steps so the packaging (npx `@vscode/vsce` package) runs and
succeeds before creating the git commit/tag/push, and ensure the commit/tag step
only runs if the build step succeeded (fail the job on build errors) so a
version/tag is never pushed without a successful .vsix build.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

What difference does it make? The VSIX isn't committed

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.

@Avni2000 — The VSIX not being committed is exactly the point. Here's what happens when the build step fails under the current ordering:

  1. ✅ package.json / package-lock.json version bump is already committed and pushed to origin
  2. ✅ The git tag (e.g. 1.2.0) is already pushed to origin
  3. ❌ npx @vscode/vsce package fails (e.g. a type error, lint failure, or the vscode:prepublish esbuild step errors out)
  4. ❌ The GitHub Release is never created — no artifact, no release page

The repo now has a dangling tag and a version-bump commit with no corresponding release. Cleaning that up requires manual steps:

git push origin --delete 1.2.0   # delete remote tag
git tag -d 1.2.0                  # delete local tag
git revert HEAD                   # or reset the version bump commit
git push ...

If instead the build runs before the push and it fails, the job simply errors out with zero side effects — no tag, no commit pushed, nothing to clean up. The fix is trivially re-running the workflow after addressing the build error.

In short: the ordering matters not because the VSIX is committed, but because the tag and version bump commit are irreversible once pushed, and they'd exist in the repo without a release to back them up.

@Avni2000
Avni2000 merged commit 2e5b930 into main Mar 20, 2026
5 checks passed
@Avni2000
Avni2000 deleted the auto-package-management branch March 20, 2026 20:26
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