fix(ci): bash regex vars, jq for version, workflow_dispatch dry-run, scoped concurrency, case fallback - #4
Conversation
…scoped concurrency, case fallback, justify || true
WalkthroughThis 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)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
.github/workflows/publish.yml.github/workflows/release-please.ymlREADME.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) |
There was a problem hiding this comment.
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.
| 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.
Summary
syntax error: unexpected token ')'— regex patterns with()must be stored in variables before use in[[ =~ ]]node -p require(...)withjqfor reading package version (no Node dependency needed)workflow_dispatchtrigger for manual dry-runs — detects bump type and logs what version would be created, but skips the actual release creationgithub.ref + github.event_nameso manual runs don't block push-triggered releases*) exit 1fallback in version bumpcasestatement|| trueon smoke test binary invocationValidating 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
[[ =~ ]]github.ref + github.event_nameto prevent manual runs from blocking push-triggered releases*) exit 1) to version bump detection logic and clarify smoke test behavior with inline comment