Skip to content

fix(ci): bash regex vars, jq for version, workflow_dispatch dry-run, scoped concurrency, case fallback - #4

Merged
callumreid merged 1 commit into
mainfrom
feat/auto-release
Mar 10, 2026
Merged

fix(ci): bash regex vars, jq for version, workflow_dispatch dry-run, scoped concurrency, case fallback#4
callumreid merged 1 commit into
mainfrom
feat/auto-release

Conversation

@callumreid

@callumreid callumreid commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes bash syntax error: unexpected token ')' — regex patterns with () must be stored in variables before use in [[ =~ ]]
  • Replaces node -p require(...) with jq for reading package version (no Node dependency needed)
  • Adds workflow_dispatch trigger for manual dry-runs — detects bump type and logs what version would be created, but skips the actual release creation
  • Scopes concurrency group to github.ref + github.event_name so manual runs don't block push-triggered releases
  • Adds *) exit 1 fallback in version bump case statement
  • Adds inline comment justifying || true on smoke test binary invocation
  • Fixes redundant "CLI interface" wording in README

Validating after merge

Once on main, go to Actions → Auto Release → Run workflow to do a dry-run on any branch without creating a release.

Changes

  • Fix: Bash regex error by storing patterns with parentheses in variables before using them with [[ =~ ]]
  • Feature: Add workflow_dispatch trigger to enable manual dry-run testing that detects bump type and logs version without creating a release
  • Refactor: Replace Node.js-based version extraction with jq for reading package.json version
  • Feature: Scope concurrency group dynamically using github.ref + github.event_name to prevent manual runs from blocking push-triggered releases
  • Fix: Add fallback case (*) exit 1) to version bump detection logic and clarify smoke test behavior with inline comment
Filename Change Type Lines Changed
.github/workflows/release-please.yml CI/CD +11/-6

…scoped concurrency, case fallback, justify || true
@coderabbitai

coderabbitai Bot commented Mar 10, 2026

Copy link
Copy Markdown

Walkthrough

This pull request modifies three files. The publish workflow gains a clarifying comment about expected binary behavior. The release-please workflow receives multiple enhancements: workflow_dispatch trigger support, dynamic concurrency grouping, jq-based version extraction, explicit regex variables for commit-type detection, error handling for unexpected bump types, and a requirement that releases only trigger on push events. The README updates example text in the Releases table, shortening "feat!: redesign CLI interface" to "feat!: redesign CLI".

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits format with 'fix' type and 'ci' scope, clearly summarizing the main changes across multiple CI/workflow improvements in the changeset.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/auto-release

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

@callumreid
callumreid merged commit 77c6ed5 into main Mar 10, 2026
2 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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-please.yml:
- Line 32: The BASE_VERSION assignment using jq can yield null or an empty
string if package.json is missing/malformed; update the release-please.yml step
that sets BASE_VERSION to capture jq's exit status and validate its output
(e.g., run jq -r '.version' package.json into a variable, check for non-zero
exit code and that BASE_VERSION is not empty and not "null"), and if validation
fails, print a clear error and exit non‑zero so downstream version computation
cannot proceed with an invalid BASE_VERSION.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ba038dab-f4e4-4739-bafb-b7ed4b3dc0f9

📥 Commits

Reviewing files that changed from the base of the PR and between 66ff317 and d39b49d.

📒 Files selected for processing (3)
  • .github/workflows/publish.yml
  • .github/workflows/release-please.yml
  • README.md

if [ -z "$LAST_TAG" ]; then
COMMITS=$(git log --format="%s")
BASE_VERSION=$(node -p "require('./package.json').version")
BASE_VERSION=$(jq -r '.version' package.json)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add error handling for jq extraction.

If package.json is missing or malformed, jq -r '.version' returns null or fails silently, leaving BASE_VERSION invalid. This causes cryptic failures downstream in version computation.

Proposed fix
-            BASE_VERSION=$(jq -r '.version' package.json)
+            BASE_VERSION=$(jq -r '.version // empty' package.json)
+            if [ -z "$BASE_VERSION" ]; then
+              echo "::error::Failed to read version from package.json"
+              exit 1
+            fi
📝 Committable suggestion

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

Suggested change
BASE_VERSION=$(jq -r '.version' package.json)
BASE_VERSION=$(jq -r '.version // empty' package.json)
if [ -z "$BASE_VERSION" ]; then
echo "::error::Failed to read version from package.json"
exit 1
fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-please.yml at line 32, The BASE_VERSION assignment
using jq can yield null or an empty string if package.json is missing/malformed;
update the release-please.yml step that sets BASE_VERSION to capture jq's exit
status and validate its output (e.g., run jq -r '.version' package.json into a
variable, check for non-zero exit code and that BASE_VERSION is not empty and
not "null"), and if validation fails, print a clear error and exit non‑zero so
downstream version computation cannot proceed with an invalid BASE_VERSION.

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.

2 participants