Skip to content

Conversation

@aimensahnoun
Copy link
Member

@aimensahnoun aimensahnoun commented Nov 4, 2024

Resolves #178

  • The previous CI was running inside of root causing wrong behaviours, this fixes that.

Summary by CodeRabbit

  • New Features

    • Introduced new scripts for release management: check-release-type and publish-next-release across multiple packages.
    • Enhanced workflow for package management by streamlining release processes.
  • Bug Fixes

    • Removed outdated script is-release-needed, improving clarity in release management.
  • Documentation

    • Updated package.json files to reflect new script functionalities for better maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2024

Walkthrough

The pull request modifies the .github/workflows/npm-publish.yaml file and the package.json files of several packages to enhance the release management process. It replaces direct shell script calls with npm commands for checking release types and publishing versions. The scripts is-release-needed are removed and replaced with check-release-type and publish-next-release across multiple packages, maintaining the overall structure while improving the integration with npm's workspace functionality.

Changes

File Path Change Summary
.github/workflows/npm-publish.yaml Replaced shell script calls with npm commands for checking release type and publishing versions.
packages/add-stakeholder/package.json Removed is-release-needed, added check-release-type and publish-next-release scripts.
packages/create-invoice-form/package.json Removed is-release-needed, added check-release-type and publish-next-release scripts.
packages/invoice-dashboard/package.json Removed is-release-needed, added check-release-type and publish-next-release scripts.
packages/payment-widget/package.json Renamed is-release-needed to check-release-type, added publish-next-release script.

Possibly related PRs

  • feat: updated the workflow and if release needed #65: The changes in the npm-publish.yaml workflow are related as they both involve updates to the release process, specifically focusing on how packages are published and versioned.
  • chore: add payment-widget to release process #132: This PR also modifies the .github/workflows/npm-publish.yaml, enhancing the release process by adding the @requestnetwork/payment-widget, which aligns with the main PR's focus on streamlining the release workflow.
  • chore: increase payment-widget version #145: Although primarily focused on version updates, this PR for the @requestnetwork/payment-widget is relevant as it ties into the overall release management process that the main PR aims to improve.

Suggested reviewers

  • MantisClone
  • sstefdev
  • rodrigopavezi

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@aimensahnoun aimensahnoun merged commit a664946 into main Nov 4, 2024
1 check was pending
@aimensahnoun aimensahnoun deleted the fix-wrong-CI branch November 4, 2024 12:53
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: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between c235bff and f64f016.

📒 Files selected for processing (5)
  • .github/workflows/npm-publish.yaml (2 hunks)
  • packages/add-stakeholder/package.json (1 hunks)
  • packages/create-invoice-form/package.json (1 hunks)
  • packages/invoice-dashboard/package.json (1 hunks)
  • packages/payment-widget/package.json (1 hunks)
🔇 Additional comments (5)
packages/add-stakeholder/package.json (1)

15-16: 🧹 Nitpick (assertive)

Review script execution context to ensure matrix package isolation.

The current implementation still references scripts from the root directory using relative paths (../../scripts/). This might not fully address the original issue of ensuring execution within the matrix package context.

Consider these alternatives to improve package isolation:

  1. Move the shell scripts into the package directory
  2. Use workspace-aware npm commands instead of direct shell script calls

Let's verify the script locations and their execution context:

packages/create-invoice-form/package.json (1)

15-16: Verify script execution context

The new scripts use relative paths (../../scripts/), which assumes execution from the package directory. Let's verify this aligns with the PR objective of executing within the matrix package context.

✅ Verification successful

Scripts correctly handle package-level execution context

The scripts are designed to work correctly within the matrix package context:

  • Both scripts use ./package.json to read package information, indicating they expect to run from the package directory
  • check-release-type.sh checks git diff in the current directory (.) for changes
  • publish-next-release.sh handles versioning and publishing for the current package

The relative path ../../scripts/ in package.json is appropriate since the scripts need to be executed from each package's directory, which aligns with the PR objective of matrix package execution.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the new scripts handle their execution context correctly
# Test: Look for path handling in the new scripts

echo "Checking check-release-type.sh:"
rg -A 5 "pwd|cd|dirname" "scripts/check-release-type.sh"

echo -e "\nChecking publish-next-release.sh:"
rg -A 5 "pwd|cd|dirname" "scripts/publish-next-release.sh"

Length of output: 271


Script:

#!/bin/bash
# Let's first check if these scripts exist and see their content
echo "Checking if scripts exist:"
ls -l scripts/check-release-type.sh scripts/publish-next-release.sh

echo -e "\nContent of check-release-type.sh (if exists):"
cat scripts/check-release-type.sh

echo -e "\nContent of publish-next-release.sh (if exists):"
cat scripts/publish-next-release.sh

# Let's also check for any package.json files that reference these scripts
echo -e "\nPackages using these scripts:"
rg -l "check-release-type|publish-next-release" "**/package.json"

Length of output: 2308

.github/workflows/npm-publish.yaml (2)

56-56: LGTM! Verify script existence in package.json files.

The change to use npm workspace for publishing aligns with the PR objective of executing within the package context.

Let's verify the script exists in all matrix packages:

#!/bin/bash
# Description: Verify publish-next-release script exists in all matrix packages
# Expected: Each package.json should contain "publish-next-release" script

for pkg in "@requestnetwork/add-stakeholder" "@requestnetwork/create-invoice-form" "@requestnetwork/invoice-dashboard" "@requestnetwork/payment-widget"; do
  echo "Checking $pkg:"
  fd -t f "package.json" | xargs rg "\"publish-next-release\":" -C 2
done

44-44: LGTM! Verify script existence in package.json files.

The change to use npm workspace for checking release type aligns with the PR objective of executing within the package context.

Let's verify the script exists in all matrix packages:

✅ Verification successful

LGTM! The check-release-type script is properly configured in all packages

The verification confirms that all packages in the matrix have the check-release-type script defined in their respective package.json files:

  • packages/add-stakeholder/package.json
  • packages/create-invoice-form/package.json
  • packages/invoice-dashboard/package.json
  • packages/payment-widget/package.json

Each package executes the script from the root scripts directory: bash ../../scripts/check-release-type.sh

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify check-release-type script exists in all matrix packages
# Expected: Each package.json should contain "check-release-type" script

for pkg in "@requestnetwork/add-stakeholder" "@requestnetwork/create-invoice-form" "@requestnetwork/invoice-dashboard" "@requestnetwork/payment-widget"; do
  echo "Checking $pkg:"
  fd -t f "package.json" | xargs rg "\"check-release-type\":" -C 2
done

Length of output: 7809

packages/invoice-dashboard/package.json (1)

15-16: LGTM! Changes align with PR objectives.

The script changes correctly implement package-level execution using relative paths, which aligns with the PR's goal of executing within the matrix package instead of the root directory.

Comment on lines +15 to +16
"check-release-type": "bash ../../scripts/check-release-type.sh",
"publish-next-release": "bash ../../scripts/publish-next-release.sh"
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Document release process changes

Consider adding comments in the package.json or updating the repository's documentation to explain:

  • The purpose of check-release-type and publish-next-release
  • When and how these scripts should be used
  • The relationship between these scripts and the CI/CD pipeline

Comment on lines +15 to +16
"check-release-type": "bash ../../scripts/check-release-type.sh",
"publish-next-release": "bash ../../scripts/publish-next-release.sh"
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Scripts need executable permissions

The referenced shell scripts exist and are consistently used across all packages, but they lack executable permissions:

  • scripts/check-release-type.sh (current: rw-r--r--)
  • scripts/publish-next-release.sh (current: rw-r--r--)

Please add executable permissions to these scripts:

chmod +x scripts/check-release-type.sh scripts/publish-next-release.sh
🔗 Analysis chain

LGTM! Verify referenced shell scripts exist.

The script changes correctly use relative paths to ensure execution from the package context, which aligns with the PR objective.

Let's verify the referenced shell scripts exist and have proper permissions:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and permissions of the referenced shell scripts

# Test: Check if the scripts exist and are executable
ls -l scripts/check-release-type.sh scripts/publish-next-release.sh

# Test: Verify these scripts are consistently used across all packages
fd -t f "package.json" packages/ -x grep -l "check-release-type\|publish-next-release"

Length of output: 471


Script:

#!/bin/bash
# Let's verify if the scripts have consistent usage across all packages by checking their content
for pkg in packages/*/package.json; do
  echo "=== $pkg ==="
  grep -A 2 "check-release-type\|publish-next-release" "$pkg"
done

Length of output: 1584

Comment on lines +15 to +16
"check-release-type": "bash ../../scripts/check-release-type.sh",
"publish-next-release": "bash ../../scripts/publish-next-release.sh"
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider improving script robustness and cross-platform compatibility.

While the current implementation works, consider these improvements:

  1. Use cross-platform npm scripts instead of direct bash calls
  2. Add script existence validation
  3. Implement proper error handling

Example improvement:

-    "check-release-type": "bash ../../scripts/check-release-type.sh",
-    "publish-next-release": "bash ../../scripts/publish-next-release.sh"
+    "check-release-type": "node ../../scripts/check-release-type.js",
+    "publish-next-release": "node ../../scripts/publish-next-release.js"

This would:

  • Improve Windows compatibility
  • Allow better error handling through Node.js
  • Enable TypeScript/JavaScript usage for better maintainability

Committable suggestion skipped: line range outside the PR's diff.

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.

Update the npm package release to make --next releases

3 participants