Skip to content

Conversation

@widoz
Copy link
Owner

@widoz widoz commented Jun 29, 2025

Allow conditional artifact pushing via a new can-push input parameter
in the configuration. Update relevant logic and tests to
respect this setting.

Summary by CodeRabbit

  • New Features
    • Introduced a new optional input to control whether assets should be pushed, with a default setting enabled.
  • Bug Fixes
    • Improved handling to skip pushing artifacts when the new input is set to false, with clear messaging.
  • Tests
    • Added and enhanced tests to verify conditional artifact pushing and improved input configuration flexibility in test setups.
  • Documentation
    • Updated README to include the new input parameter with usage examples and corrected minor grammatical issues.

Allow conditional artifact pushing via a new `can-push` input parameter
in the configuration. Update relevant logic and tests to
respect this setting.
@codecov
Copy link

codecov bot commented Jun 29, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@coderabbitai
Copy link

coderabbitai bot commented Jun 29, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The changes introduce a new optional input, can-push, to the GitHub Action, allowing conditional control over whether artifacts are pushed. Supporting logic is added in the configuration and artifact handling code to respect this input. Tests are updated to verify the new conditional push behavior and to improve input mocking flexibility.

Changes

File(s) Change Summary
action.yml Added optional input can-push (default 'true'); marked command and target-dir as not required.
src/configuration.ts Added canPush getter to Configuration class, returning boolean based on can-push input.
src/model/artifacts.ts Updated push method to skip pushing if canPush is false; logs message and returns early.
tests/unit/model/artifacts.test.ts Added test for can-push: false; improved input mocking and configuration helper flexibility.
README.md Documented new can-push input; corrected grammar; added example usage (with a typo in example key).

Sequence Diagram(s)

sequenceDiagram
    participant GitHub_Action
    participant Configuration
    participant Artifacts

    GitHub_Action->>Configuration: Read inputs (including can-push)
    GitHub_Action->>Artifacts: Initiate push
    Artifacts->>Configuration: Check canPush
    alt canPush is true
        Artifacts->>Artifacts: Perform git push
        Artifacts->>GitHub_Action: Log remote messages
    else canPush is false
        Artifacts->>GitHub_Action: Log "Skipping pushing artifacts."
        Artifacts-->>GitHub_Action: Return early
    end
Loading

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c04569f and 6c067d6.

📒 Files selected for processing (1)
  • README.md (3 hunks)
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch feature/add-can-push-input

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this 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.

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 (1)
action.yml (1)

15-15: Fix grammatical error in description.

The description should use "Whether" instead of "Whenever" for correct grammar.

-    description: 'Whenever the assets shall be pushed'
+    description: 'Whether the assets shall be pushed'
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9db5d51 and c04569f.

⛔ Files ignored due to path filters (1)
  • dist/index.js is excluded by !**/dist/**
📒 Files selected for processing (4)
  • action.yml (1 hunks)
  • src/configuration.ts (1 hunks)
  • src/model/artifacts.ts (1 hunks)
  • tests/unit/model/artifacts.test.ts (5 hunks)
🔇 Additional comments (6)
action.yml (1)

10-10: LGTM! Good backward compatibility approach.

The explicit required: false declarations improve clarity, and the new can-push input is well-structured with a sensible default value that maintains backward compatibility.

Also applies to: 13-13, 14-17

src/configuration.ts (1)

24-26: LGTM! Consistent implementation pattern.

The canPush getter follows the same pattern as other configuration getters and correctly handles the string-to-boolean conversion for GitHub Actions inputs.

src/model/artifacts.ts (1)

59-62: LGTM! Clean conditional logic implementation.

The early return pattern with informative logging is well-implemented. The conditional check correctly respects the canPush configuration and provides clear feedback when artifacts pushing is skipped.

tests/unit/model/artifacts.test.ts (3)

25-30: LGTM! Comprehensive mocking setup.

The expanded mocking of @actions/core functions provides proper test coverage for the new logging functionality.


96-119: LGTM! Thorough test coverage for conditional push behavior.

The test case properly verifies both aspects of the conditional push feature:

  1. The push operation is skipped (git.push not called)
  2. The informative message is logged

This provides comprehensive coverage of the new functionality.


204-233: LGTM! Flexible test configuration approach.

The refactored configuration helper functions enable easy testing of different input scenarios while maintaining clean, readable test code. The InputsConfiguration type and parameter handling are well-implemented.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 29, 2025
@widoz widoz merged commit f5ece0f into main Jun 30, 2025
1 of 2 checks passed
@widoz widoz deleted the feature/add-can-push-input branch June 30, 2025 15:43
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.

2 participants