Skip to content

Conversation

@pdp2121
Copy link
Collaborator

@pdp2121 pdp2121 commented Nov 18, 2025

High Level Overview of Change

Address some outstanding comments in #3133.
Changes include:

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Did you update HISTORY.md?

  • Yes
  • No, this change does not impact library users

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

Walkthrough

This PR renames and normalizes release workflow inputs and env vars: PACKAGE_NAME_INPUTPKG_NAME, NPMJS_DIST_TAG_INPUTNPM_DIST_TAG (normalized to DIST_TAG), and replaces PACKAGE_NAME/PACKAGE_VERSION with PKG_NAME/PKG_VERSION across the release workflow.

Changes

Cohort / File(s) Summary
Release workflow variable renames
\.github/workflows/release.yml
Renamed inputs/env keys and outputs: PACKAGE_NAME_INPUTPKG_NAME, NPMJS_DIST_TAG_INPUTNPM_DIST_TAG (internal DIST_TAG), PACKAGE_VERSIONPKG_VERSION, and version output → package_version. Updated all validation, messaging, tag construction (${PKG_NAME}@${PKG_VERSION}), packaging, Slack/PR texts, tarball paths, lerna/npm publishing steps, SBOM/vuln reports, and downstream references to use the new names.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify all occurrences of the old variable names were replaced (inputs, env, outputs, and messages).
  • Check Git tag and package tarball paths use ${PKG_NAME}@${PKG_VERSION} consistently.
  • Confirm Slack/PR message templates and SBOM/vulnerability steps interpolate the new vars correctly.

Possibly related PRs

Suggested reviewers

  • shichengripple001
  • ckeshava
  • kuan121
  • achowdhry-ripple

Poem

🐰 I hopped through YAML lines so neat,
Swapping PACKAGE for PKG in fleet.
DIST_TAG guided each tidy string,
package_version now takes wing—
Release bells hop, and tags repeat. 🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title "chores: assorted fixes for release.yaml" accurately describes the main change—refactoring and fixes to the release workflow file.
Description check ✅ Passed The description includes the high-level overview, context, type of change, and HISTORY.md status, following the template structure. All required sections are completed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-command-injection-2

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 52d2b4b and 7c2d204.

📒 Files selected for processing (1)
  • .github/workflows/release.yml (17 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-09-26T21:14:56.813Z
Learnt from: mvadari
Repo: XRPLF/xrpl.js PR: 2788
File: .github/workflows/nodejs.yml:25-25
Timestamp: 2024-09-26T21:14:56.813Z
Learning: In `.github/workflows/nodejs.yml`, the `build-and-lint` job's actions `actions/setup-node` and `actions/cache` are updated to `v4`.

Applied to files:

  • .github/workflows/release.yml
📚 Learning: 2025-10-09T20:16:27.834Z
Learnt from: ckeshava
Repo: XRPLF/xrpl.js PR: 3101
File: .github/workflows/nodejs.yml:220-221
Timestamp: 2025-10-09T20:16:27.834Z
Learning: In `.github/workflows/nodejs.yml`, the `generate-documentation` job intentionally uses `if: startsWith(github.ref, 'refs/tags/xrpl@')` instead of `env.GIT_REF` to ensure documentation is only generated and deployed on actual tag push events, not when the workflow is called via `workflow_call` with a tag reference.

Applied to files:

  • .github/workflows/release.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: integration (20.x)
  • GitHub Check: integration (22.x)
  • GitHub Check: build-and-lint (24.x)
  • GitHub Check: integration (24.x)
  • GitHub Check: unit (20.x)
  • GitHub Check: unit (24.x)
  • GitHub Check: unit (22.x)
  • GitHub Check: browser (24.x)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (5)
.github/workflows/release.yml (5)

25-25: Approved: Output naming changed correctly.

The get_version job output is properly renamed from version to package_version (line 25), and step 95 correctly outputs it at line 119. Downstream jobs correctly reference needs.get_version.outputs.package_version at lines 122, 130, 144, 552, and 668.

Also applies to: 119-119


32-120: Approved: Input validation and environment variable handling are sound.

The get_version job properly validates and normalizes inputs:

  • Line 50-58: Package name validation guards against path traversal and command injection
  • Lines 74-92: Distribution tag validation with sensible defaults
  • Lines 111-119: Duplicate dist-tag normalization logic applied consistently

Environment variables PKG_NAME, NPM_DIST_TAG are set from inputs and DIST_TAG is correctly derived for internal use.


148-149: Approved: Environment variables propagated consistently across jobs.

Jobs pre_release, ask_for_dev_team_review, and release correctly set PKG_VERSION from needs.get_version.outputs.package_version and PKG_NAME from github.event.inputs.package_name. All downstream steps reference these correctly in messages, tags, and API calls.

Also applies to: 314-315, 554-555


268-268: Approved: Variable naming consistently applied in user-facing output.

All Slack notifications, issue creation, git tagging, package messaging, and release notes correctly use the renamed variables:

  • ${PKG_NAME}@${PKG_VERSION} for package identification (lines 268, 271, 605, 643, 658)
  • ${PKG_NAME} for directory/lerna references (lines 286, 295, 449, 470, 529)
  • ${PKG_VERSION} for OWASP/artifact uploads (lines 215, 274)

Also applies to: 271-271, 274-274, 286-286, 295-299, 449-450, 470-470, 529-529, 605-605, 643-643, 658-658


328-328: Verify input handling for npmjs_dist_tag edge cases.

The workflow defines a default "latest" for npmjs_dist_tag at line 14, yet validation and npm publish steps check for empty strings (lines 75, 591). Conditional logic at line 328 also checks == ''. Verify that GitHub Actions applies the input default consistently, or confirm that the empty string checks are intentional defensive guards.

Additionally, the prerelease/make_latest logic at lines 627-628 checks the input directly rather than using the normalized DIST_TAG value. Confirm this is intentional (e.g., to preserve the original user intent for release metadata).

Also applies to: 585-599, 627-628


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.

@pdp2121
Copy link
Collaborator Author

pdp2121 commented Nov 18, 2025

@shichengripple001 would you mind taking a look at these changes to make sure nothing will break? Thanks!

@pdp2121 pdp2121 requested review from ckeshava and kuan121 November 18, 2025 19:38
kuan121
kuan121 previously approved these changes Nov 18, 2025
Copy link
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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/release.yml (1)

25-25: Critical: Job output key mismatch will cause downstream failures.

Line 25 defines the job output as package_version: ${{ steps.get_version.outputs.version }}, but line 119 writes package_version=${VERSION} to $GITHUB_OUTPUT. This creates a mismatch where the step outputs key package_version but the job output definition tries to read key version, causing all downstream jobs that reference needs.get_version.outputs.package_version to receive empty/null values.

Line 25 must be updated to reference the correct output key:

  outputs:
-   package_version: ${{ steps.get_version.outputs.version }}
+   package_version: ${{ steps.get_version.outputs.package_version }}

Also applies to: 119-119

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

74-77: Consolidate duplicated DIST_TAG derivation and validation logic.

The logic to derive DIST_TAG from NPM_DIST_TAG and validate it appears in three separate locations:

  • Lines 74–77 in the "Validate inputs" step
  • Lines 111–114 in the "Get package version" step
  • Lines 590–593 in the "Publish to npm" step

Each instance also includes separate validation (lines 81–90, 115–118, 594–597). This duplication introduces maintenance risk and cognitive load. Consider extracting this into a shared reusable workflow, a composite action, or a documented helper function to ensure consistent validation across all publish paths.

Also applies to: 111-114, 590-593

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8abcf5a and 52d2b4b.

📒 Files selected for processing (1)
  • .github/workflows/release.yml (16 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-09-26T21:14:56.813Z
Learnt from: mvadari
Repo: XRPLF/xrpl.js PR: 2788
File: .github/workflows/nodejs.yml:25-25
Timestamp: 2024-09-26T21:14:56.813Z
Learning: In `.github/workflows/nodejs.yml`, the `build-and-lint` job's actions `actions/setup-node` and `actions/cache` are updated to `v4`.

Applied to files:

  • .github/workflows/release.yml
📚 Learning: 2025-10-09T20:16:27.834Z
Learnt from: ckeshava
Repo: XRPLF/xrpl.js PR: 3101
File: .github/workflows/nodejs.yml:220-221
Timestamp: 2025-10-09T20:16:27.834Z
Learning: In `.github/workflows/nodejs.yml`, the `generate-documentation` job intentionally uses `if: startsWith(github.ref, 'refs/tags/xrpl@')` instead of `env.GIT_REF` to ensure documentation is only generated and deployed on actual tag push events, not when the workflow is called via `workflow_call` with a tag reference.

Applied to files:

  • .github/workflows/release.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: integration (20.x)
  • GitHub Check: integration (24.x)
  • GitHub Check: browser (24.x)
  • GitHub Check: integration (22.x)
  • GitHub Check: unit (22.x)
  • GitHub Check: unit (24.x)
  • GitHub Check: unit (20.x)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
.github/workflows/release.yml (2)

148-149: Standardized variable naming applied consistently across jobs.

The PKG_NAME and PKG_VERSION environment variables are set correctly in all affected jobs (pre_release, ask_for_dev_team_review, release) and used consistently throughout downstream steps. This improves clarity and reduces confusion compared to the previous mixed naming convention.

Also applies to: 314-315, 554-555


32-92: Input validation for PKG_NAME is robust and well-structured.

The validation logic correctly guards against:

  • Invalid characters in package name (line 50–53)
  • Path traversal attacks via .. or / (line 55–58)
  • Invalid npm dist-tag format (lines 81–90)

Defaulting to latest when npmjs_dist_tag is empty (lines 74–77) is sensible and documented. The validation flow is clear and provides specific error messages for each failure mode.

PACKAGE_NAME_INPUT: ${{ github.event.inputs.package_name }}
NPMJS_DIST_TAG_INPUT: ${{ github.event.inputs.npmjs_dist_tag }}
PKG_NAME: ${{ github.event.inputs.package_name }}
NPM_DIST_TAG: ${{ github.event.inputs.npmjs_dist_tag }}
Copy link

Choose a reason for hiding this comment

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

You can just name this DIST_TAG directly, since in the script below you call DIST_TAG="${NPM_DIST_TAG}" and don't use NPM_DIST_TAG for anything else.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In line 76 we reassign the value to latest which I believe is not allowed for env variable, that's why we need an intermediate value. However, this is only used for printing out messages so we can use something like ${NPM_DIST_TAG:-latest}. Let me know what you think

Copy link

Choose a reason for hiding this comment

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

In line 76 we reassign the value to latest which I believe is not allowed for env variable, that's why we need an intermediate value.

Are you saying that if ${{ github.event.inputs.npmjs_dist_tag }} is "latest" then GitHub will not execute the workflow?

Assuming you'd rename NPM_DIST_TAG to DIST_TAG here in the env: section, then below you can just do:

# Empty → default to 'latest'
if [ -z "${DIST_TAG}" ]; then
  DIST_TAG="latest"
  echo "ℹ️ npmjs_dist_tag empty → defaulting to 'latest'."
fi

no? I've never heard of the value "latest" not being allowed as an env var, that would be very odd. (then again, Gmail doesn't allow you to use a label "Finance", so sometimes things one sees in the world are just strange).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, you are right, it's just a good practice not to reassign env variable since it is shared within the job, but you can certainly do so. Also, in our case it does not affect anything since these steps are at the end of the job. However, since this is pretty minor, I would prefer to keep it as is just to follow good practice

Copy link

Choose a reason for hiding this comment

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

That's fair. I don't know if next steps will use the original or the modified env var.

Copy link

Choose a reason for hiding this comment

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

btw you can also just do:

DIST_TAG: ${{ github.event.inputs.npmjs_dist_tag || "latest" }}

and then you don't need the check in the script.

@pdp2121
Copy link
Collaborator Author

pdp2121 commented Nov 18, 2025

Line 25 must be updated to reference the correct output key:

  outputs:
-   package_version: ${{ steps.get_version.outputs.version }}
+   package_version: ${{ steps.get_version.outputs.package_version }}

Great catch! Fixed in a later commit

@pdp2121 pdp2121 requested review from bthomee and kuan121 November 18, 2025 19:50
PACKAGE_NAME_INPUT: ${{ github.event.inputs.package_name }}
NPMJS_DIST_TAG_INPUT: ${{ github.event.inputs.npmjs_dist_tag }}
PKG_NAME: ${{ github.event.inputs.package_name }}
NPM_DIST_TAG: ${{ github.event.inputs.npmjs_dist_tag }}
Copy link

Choose a reason for hiding this comment

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

btw you can also just do:

DIST_TAG: ${{ github.event.inputs.npmjs_dist_tag || "latest" }}

and then you don't need the check in the script.

@pdp2121 pdp2121 merged commit afd2a1e into main Nov 21, 2025
12 checks passed
@pdp2121 pdp2121 deleted the fix-command-injection-2 branch November 21, 2025 20:07
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.

4 participants