Skip to content

Conversation

@abhijeetw035
Copy link
Contributor

@abhijeetw035 abhijeetw035 commented Apr 3, 2025

📋 Description

JIRA ID:

GitHub Issue: Fixes PSMRI/AMRIT#58

  • Added a prebuild script in package.json to ensure environment.ts is created before running ng build.
  • Upgraded GitHub Actions upload-artifact action from v2 to v3 in .github/workflows/package.yml.
  • Updated GitHub Actions workflow to include submodule checkout and initialization, ensuring all dependencies are correctly fetched before the build.
  • These changes help prevent build failures due to missing environment files, ensure compatibility with the latest GitHub Actions version, and properly handle repositories with submodules.

✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves 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 (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

🔬 How Changes Were Tested

  • Ran npm run build locally to verify that the environment file is created correctly before the build process starts.
  • Confirmed that GitHub Actions workflow executes successfully with the updated upload-artifact action.
  • Verified that submodules are correctly initialized and updated during the GitHub Actions build process.

📸 Screenshots:

image

image

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

Summary by CodeRabbit

  • Chores
    • Enhanced the continuous integration process to ensure robust dependency handling and an optimized build routine.
    • Updated the artifact upload mechanism to leverage the latest improvements for a smoother workflow.

@coderabbitai
Copy link

coderabbitai bot commented Apr 3, 2025

Walkthrough

The pull request updates two GitHub Actions workflow files. In the build workflow, the checkout step has been renamed and enhanced to automatically retrieve submodules, with an added manual update step. The build command has been switched from npm run build to npm run build-ci. In the package workflow, the version of the actions/upload-artifact action has been updated from v2 to v3. No changes were made to public or exported entities.

Changes

File Changes Summary
.github/workflows/build-on-pull-request.yml Renamed checkout step to "Checkout code with submodules", enabled submodules: true, added "Update submodules manually (if needed)" step, and switched build command to npm run build-ci.
.github/workflows/package.yml Updated the artifact upload action from actions/upload-artifact@v2 to actions/upload-artifact@v3.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub as GitHub Actions
    participant Repo as Repository (with Submodules)
    participant Builder as Build Process

    GitHub->>Repo: Checkout code with submodules (submodules: true)
    Repo-->>GitHub: Return code and submodules
    GitHub->>Repo: Update submodules manually (if needed)
    Repo-->>GitHub: Submodules updated
    GitHub->>Builder: Execute "npm run build-ci"
    Builder-->>GitHub: Build process completed
Loading

Assessment against linked issues

Objective Addressed Explanation
Ensure CI/CD build passes with the correct build command and submodules update (#58)
Ensure required Git submodules are correctly included (#58)
Ensure the CI/CD pipeline uses the correct Node.js version (#58) Node.js version configuration is not explicitly addressed.

Possibly related PRs

Suggested reviewers

  • drtechie

Poem

I'm a little rabbit, hopping with glee,
Updating workflows for submodules with ease.
With a new build command in my code garden so bright,
And artifacts uploaded, everything feels just right.
Happy coding, carrot crunch, all day and night!
🥕🐰


🪧 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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

Copy link

@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

🧹 Nitpick comments (4)
.github/workflows/package.yml (1)

47-47: Remove Trailing Whitespace
There is trailing whitespace at the end of line 47. Please remove it to meet YAML linting standards.

🧰 Tools
🪛 actionlint (1.7.4)

47-47: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.35.1)

[error] 47-47: trailing spaces

(trailing-spaces)

.github/workflows/build-on-pull-request.yml (2)

16-16: Remove Trailing Whitespace
There is trailing whitespace on line 16. Removing this will help resolve YAML lint issues.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 16-16: trailing spaces

(trailing-spaces)


42-42: Missing Newline at End of File
A newline at the end of the file is missing. Please add one to adhere to best practices and YAML standards.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 42-42: no new line character at the end of file

(new-line-at-end-of-file)

package.json (1)

7-8: Prebuild and Build Script Update
The new "prebuild" script ensures that the src/environments/environment.ts file exists before running the build, which is an effective safeguard against missing environment files. The updated "build" script now correctly invokes this precondition.
Consider the potential cross-platform impact of the shell command (test -f ... || touch ...)—if Windows compatibility is a requirement, you might want to explore a Node.js–based solution or use a cross-platform utility.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2792b47 and 765fdc2.

📒 Files selected for processing (3)
  • .github/workflows/build-on-pull-request.yml (2 hunks)
  • .github/workflows/package.yml (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/package.yml

47-47: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

.github/workflows/build-on-pull-request.yml

12-12: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.35.1)
.github/workflows/package.yml

[error] 47-47: trailing spaces

(trailing-spaces)

.github/workflows/build-on-pull-request.yml

[error] 16-16: trailing spaces

(trailing-spaces)


[error] 42-42: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (2)
.github/workflows/package.yml (1)

46-51: Artifact Upload Action Update Verification
The step now uses actions/upload-artifact@v3 which meets the intended upgrade. However, static analysis indicates that this version’s runner might be outdated for GitHub Actions; please verify that this change runs as expected in your CI environment.

🧰 Tools
🪛 actionlint (1.7.4)

47-47: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.35.1)

[error] 47-47: trailing spaces

(trailing-spaces)


[error] 50-50: trailing spaces

(trailing-spaces)

.github/workflows/build-on-pull-request.yml (1)

11-16: Enhanced Checkout with Submodules
The "Checkout code with submodules" step now includes the submodules: true parameter, which ensures submodules are automatically checked out. This aligns with the PR objectives. However, similar to the artifact upload action, please double-check that the runner used with actions/checkout@v3 supports these options as expected in your environment.

🧰 Tools
🪛 actionlint (1.7.4)

12-12: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.35.1)

[error] 16-16: trailing spaces

(trailing-spaces)

@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 6, 2025

Copy link

@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

🧹 Nitpick comments (2)
.github/workflows/build-on-pull-request.yml (2)

11-17: Enhanced Submodule Checkout Step with Minor Formatting Note
The updated "Checkout code with submodules" step correctly enables submodule retrieval by using submodules: true with actions/checkout@v3. This is an excellent enhancement for repositories relying on submodules. Note that static analysis flagged two issues: a potential recommendation to update the action version and trailing spaces on line 16. Please verify—according to the latest GitHub Actions documentation—if actions/checkout@v3 is ideal or if a newer version is available. Additionally, remove the trailing spaces to satisfy YAML lint requirements.

-          submodules: true  
+          submodules: true
🧰 Tools
🪛 actionlint (1.7.4)

12-12: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.35.1)

[error] 16-16: trailing spaces

(trailing-spaces)


42-42: Build Command Update and File Formatting Improvement
Switching the build command to npm run build-ci aligns with the new CI process. Ensure that the corresponding npm script is correctly defined in your package.json. Moreover, YAMLlint flagged a missing newline at the end of the file. Adding a newline will improve conformity with best practices.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 42-42: no new line character at the end of file

(new-line-at-end-of-file)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 765fdc2 and 41193d1.

📒 Files selected for processing (1)
  • .github/workflows/build-on-pull-request.yml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-on-pull-request.yml

12-12: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.35.1)
.github/workflows/build-on-pull-request.yml

[error] 16-16: trailing spaces

(trailing-spaces)


[error] 42-42: no new line character at the end of file

(new-line-at-end-of-file)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build
🔇 Additional comments (1)
.github/workflows/build-on-pull-request.yml (1)

18-21: Added Manual Submodule Update Fallback
The introduction of the "Update submodules manually (if needed)" step is a robust fallback to ensure that submodules are fully initialized and updated recursively. This adds a layer of redundancy in case the automatic checkout does not cover all submodule scenarios.

@drtechie drtechie merged commit f0c9235 into PSMRI:develop Apr 7, 2025
4 checks passed

- name: Upload WAR file as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
Copy link
Member

Choose a reason for hiding this comment

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

@abhijeetw035 guess you have to use v4.
v3 is deprecated.

Copy link
Contributor Author

@abhijeetw035 abhijeetw035 Apr 7, 2025

Choose a reason for hiding this comment

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

Thank you @drtechie, should raise new PR on ADMIN-UI that updates all action's versions?

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.

[C4GT Community]: Ensure GitHub Actions Pass Successfully with Correct Node Version and Submodules in Admin-UI

2 participants