Skip to content

Test raindex npm release from PR#2585

Open
findolor wants to merge 3 commits into
mainfrom
fix-raindex-npm-release-pr-trigger
Open

Test raindex npm release from PR#2585
findolor wants to merge 3 commits into
mainfrom
fix-raindex-npm-release-pr-trigger

Conversation

@findolor
Copy link
Copy Markdown
Collaborator

@findolor findolor commented May 21, 2026

Motivation

The npm package release workflow is failing while bumping ui-components because npm tries to resolve @rainlanguage/raindex from the public registry before the renamed package has been published.

Solution

  • Add a temporary same-repo PR trigger for the npm release workflow so we can validate the publish path from this PR.
  • Check out the PR branch when running on pull_request so release commits can be pushed back to the branch.
  • Disable npm's automatic workspace dependency update during version bumps with --no-workspaces-update.
  • Push CI-created release commits back to the triggering branch.

Checks

  • Parsed .github/workflows/npm-package-release.yml locally with Ruby YAML.load_file.

Summary by CodeRabbit

  • Chores
    • Enhanced CI/CD pipeline workflows to improve release automation and testing processes.
    • Added bootstrap publishing workflow for improved package management and deployment efficiency.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Warning

Rate limit exceeded

@findolor has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 17 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ba62e8c0-f92c-4d56-8307-c848db2bd903

📥 Commits

Reviewing files that changed from the base of the PR and between af38fbb and 331cd86.

📒 Files selected for processing (1)
  • .github/workflows/npm-raindex-bootstrap-publish.yml
📝 Walkthrough

Walkthrough

The PR extends the npm-package-release workflow to support pull request events with proper gating and ref alignment, and introduces a new bootstrap publishing workflow that manually publishes the raindex package to npm with version verification and conditional publishing logic.

Changes

NPM Package Release PR Support

Layer / File(s) Summary
PR event trigger and job gating
.github/workflows/npm-package-release.yml
Added pull_request trigger targeting main and updated job-level condition to gate PR execution to same-repo PRs while preserving existing main-branch push behavior.
PR-aware checkout and push configuration
.github/workflows/npm-package-release.yml
Updated actions/checkout to set ref to github.head_ref || github.ref_name for PR branch alignment, and modified git push to explicitly target origin at the computed ref instead of relying on default ref selection.
Version bump sequence restructuring
.github/workflows/npm-package-release.yml
Reordered prerelease steps so raindex prerelease executes before dependency version propagation and prettier formatting, then ui-components prerelease runs after prettier updates its package.json.

Bootstrap Raindex NPM Publish Workflow

Layer / File(s) Summary
Workflow definition and npm authentication
.github/workflows/npm-raindex-bootstrap-publish.yml
Introduced workflow with workflow_dispatch trigger, sets NODE_AUTH_TOKEN environment variable from secrets.NPM_TOKEN for registry authentication, and establishes the job scaffold.
Build environment setup and Node.js configuration
.github/workflows/npm-raindex-bootstrap-publish.yml
Configures repository checkout, disk space optimization, Nix installer with flake cache, and Node.js 24.x with npm registry-url authentication.
Build verification and conditional npm publishing
.github/workflows/npm-raindex-bootstrap-publish.yml
Verifies npm authentication with npm whoami, installs dependencies and builds raindex workspace, reads package version, performs npm version existence check, and publishes with bootstrap tag and --access public when the version does not already exist.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Workflows now dance with PRs in hand,
Refs aligned across the land,
Bootstrap tags on raindex fly,
Version checks before we try!
CI/CD spins with purpose bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'Test raindex npm release from PR' is partially related to the changeset. It refers to testing the npm release workflow from a PR context, which is addressed in the modifications to the npm-package-release workflow, but it does not capture the main objective of fixing the raindex npm release process or the structural workflow changes made. Consider a more specific title like 'Fix raindex npm release workflow to support PR triggers' or 'Add PR-triggered npm release validation with workspace dependency control' to better reflect the primary changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 fix-raindex-npm-release-pr-trigger

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.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/npm-package-release.yml:
- Line 217: The git push line interpolates github.head_ref directly into the
shell which risks template injection; fix it by assigning the branch expression
to a workflow environment variable (e.g., GIT_REF = ${{ github.head_ref ||
github.ref_name }}) and then use a quoted env variable in the push command (git
push origin HEAD:"$GIT_REF") so the shell receives a single safely-escaped
argument; update the workflow step that contains git push origin HEAD:${{
github.head_ref || github.ref_name }} to use the GIT_REF env var and ensure the
push command uses double quotes around $GIT_REF.
🪄 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: 4b6e2525-843b-40fa-bbb1-5de21c5bb39f

📥 Commits

Reviewing files that changed from the base of the PR and between 4c45f99 and af38fbb.

📒 Files selected for processing (2)
  • .github/workflows/npm-package-release.yml
  • .github/workflows/npm-raindex-bootstrap-publish.yml

if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
git push origin
git push origin HEAD:${{ github.head_ref || github.ref_name }}
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 | ⚡ Quick win

Template injection vulnerability in git push command.

github.head_ref is directly interpolated into the shell command, which zizmor correctly flags as a template injection risk. Although GitHub restricts many special characters in branch names and the workflow already blocks fork PRs, the recommended practice is to use an intermediate environment variable for proper shell escaping.

🛡️ Proposed fix using environment variable
     - name: Push Changes To Remote
       if: ${{ env.OLD_HASH != env.NEW_HASH }}
       run: |
-        git push origin HEAD:${{ github.head_ref || github.ref_name }}
+        git push origin "HEAD:${TARGET_REF}"
         git push -u origin "npm-raindex-v${{ env.RAINDEX_NEW_VERSION }}-uc-v${{ env.UC_NEW_VERSION }}"
       env:
         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        TARGET_REF: ${{ github.head_ref || github.ref_name }}
🧰 Tools
🪛 zizmor (1.25.2)

[error] 217-217: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)


[error] 217-217: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/npm-package-release.yml at line 217, The git push line
interpolates github.head_ref directly into the shell which risks template
injection; fix it by assigning the branch expression to a workflow environment
variable (e.g., GIT_REF = ${{ github.head_ref || github.ref_name }}) and then
use a quoted env variable in the push command (git push origin HEAD:"$GIT_REF")
so the shell receives a single safely-escaped argument; update the workflow step
that contains git push origin HEAD:${{ github.head_ref || github.ref_name }} to
use the GIT_REF env var and ensure the push command uses double quotes around
$GIT_REF.

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