Skip to content

fix: add prominent commit format section to copilot instructions#408

Merged
Jamie-BitFlight merged 2 commits intomainfrom
claude/rebase-pr-400-011CUp8U5eFJ4FESLYU5ASDP
Nov 5, 2025
Merged

fix: add prominent commit format section to copilot instructions#408
Jamie-BitFlight merged 2 commits intomainfrom
claude/rebase-pr-400-011CUp8U5eFJ4FESLYU5ASDP

Conversation

@Jamie-BitFlight
Copy link
Contributor

@Jamie-BitFlight Jamie-BitFlight commented Nov 5, 2025

Description

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)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test update
  • Build/CI update
  • Other (please describe):

Related Issues

  • Fixes #
  • Related to #

Changes Made

Testing

  • All existing tests pass
  • Added new tests for new functionality
  • Manually tested the changes
  • Updated documentation

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

Release Notes

  • Documentation

    • Added comprehensive Conventional Commits guidelines with required format, common types, examples, and validation instructions.
    • Added Node 20.x version requirement documentation with verification steps.
  • Bug Fixes

    • Corrected default values loading to use the action's own configuration file instead of user-provided configuration files.

- Add integration test for issue #335 to validate graceful handling of missing action.yml
- Fix .git/config setup in test to prevent "No owner or repo found" error
- Remove redundant await in test vi.mock() calls to fix ESLint errors
- Add clarifying comments explaining __dirname usage for action.yml path resolution
- Rebuild dist files

Fixes #335
Add critical warning about conventional commits at the top of
copilot-instructions.md with clear examples and type definitions
to prevent future commit format mistakes.
@coderabbitai
Copy link

coderabbitai bot commented Nov 5, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR updates documentation with commit message and Node version guidelines, removes unnecessary awaits from mock imports across test files, adds a new test for loading the action's own defaults, updates integration test expectations for error handling, and modifies production code to load defaults from the tool's own action.yml instead of a user's action.yml.

Changes

Cohort / File(s) Summary
Documentation
.github/copilot-instructions.md
Added commit message format guidelines with Conventional Commits requirements, types, examples, and validation command. Added Node 20.x version requirement section.
Mock Import Simplifications
__tests__/action.test.ts, __tests__/helpers.test.ts, __tests__/readme-generator.test.ts
Removed unnecessary await from dynamic imports in mock setup; imports now return promises directly within async factory functions.
Test Enhancements
__tests__/inputs.test.ts
Removed await from fs mock import. Added new test case validating that collectAllDefaultValuesFromAction loads defaults from the action's own action.yml when given a relative path.
Integration Test Updates
__tests__/integration-issue-335.test.ts
Added .git/config directory creation to simulate a Git repository in test setup. Updated test expectations to check for "Missing required keys" error instead of missing action.yml error.
Production Logic
src/inputs.ts
Modified collectAllDefaultValuesFromAction to explicitly construct the path to the tool's own action.yml using __dirname and the provided meta action path, ensuring defaults are loaded from the tool rather than a user's action.yml.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • src/inputs.ts: Review the logic change carefully to verify that switching from user's to tool's action.yml resolves the correct defaults and doesn't break existing workflows.
  • __tests__/integration-issue-335.test.ts: Confirm that the new test setup with .git/config properly simulates the expected environment and that error expectation changes align with intended behavior.
  • Mock import changes: Verify that removing await from dynamic imports doesn't cause unintended Promise wrapping or timing issues in test execution.

Possibly related PRs

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/rebase-pr-400-011CUp8U5eFJ4FESLYU5ASDP

📜 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 29bcc62 and 6b144f2.

⛔ Files ignored due to path filters (4)
  • dist/bin/index.js is excluded by !**/dist/**, !dist/**
  • dist/mjs/inputs.js is excluded by !**/dist/**, !dist/**
  • dist/mjs/inputs.js.map is excluded by !**/dist/**, !**/*.map, !dist/**
  • dist/types/index.d.ts is excluded by !**/dist/**, !dist/**
📒 Files selected for processing (7)
  • .github/copilot-instructions.md (1 hunks)
  • __tests__/action.test.ts (1 hunks)
  • __tests__/helpers.test.ts (1 hunks)
  • __tests__/inputs.test.ts (2 hunks)
  • __tests__/integration-issue-335.test.ts (2 hunks)
  • __tests__/readme-generator.test.ts (1 hunks)
  • src/inputs.ts (1 hunks)

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.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 49.87% 403 / 808
🔵 Statements 50.54% 415 / 821
🔵 Functions 65.74% 71 / 108
🔵 Branches 49.38% 200 / 405
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/inputs.ts 90.38% 81.03% 100% 90.38% 333-338, 367-368, 396, 485, 620-625
Generated in workflow #215 for commit 6b144f2 by the Vitest Coverage Report Action

@Jamie-BitFlight Jamie-BitFlight merged commit 27cef3b into main Nov 5, 2025
11 checks passed
@Jamie-BitFlight Jamie-BitFlight deleted the claude/rebase-pr-400-011CUp8U5eFJ4FESLYU5ASDP branch November 5, 2025 05:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses issue #335 by fixing a path resolution error when the tool is run via npx or yarn dlx. The main problem was that collectAllDefaultValuesFromAction() attempted to load the tool's own action.yml file, which doesn't exist when installed via npm (it's not in the "files" array). The fix gracefully handles this scenario by catching the error and continuing without default values.

Key Changes

  • Added explanatory comments in src/inputs.ts to clarify that collectAllDefaultValuesFromAction() loads the tool's own action.yml, not the user's
  • Updated integration test to validate the fix works when action.yml is missing
  • Removed unnecessary await keywords from dynamic imports in test files (code style improvement)
  • Added commit message format guidelines to .github/copilot-instructions.md

Reviewed Changes

Copilot reviewed 7 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/inputs.ts Added clarifying comments explaining that the function loads the tool's own action.yml
tests/integration-issue-335.test.ts Updated test to verify graceful handling of missing action.yml and simulate git repository
tests/inputs.test.ts Added test case for loading tool's own action.yml and updated comments
tests/*.test.ts Removed unnecessary await from dynamic imports
.github/copilot-instructions.md Added commit message format guidelines
dist/* Build artifacts regenerated from source changes

const gitDir = path.join(tempDir, '.git');
fs.mkdirSync(gitDir);
const gitConfig = `[remote "origin"]
\turl = https://github.com/test-owner/test-repo.git
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

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

[nitpick] The git config uses a literal tab character (\\t) in the template string. While this works, it's more maintainable to use consistent whitespace. Consider using spaces or explicitly documenting why the tab is required (if the git config parser requires it).

Suggested change
\turl = https://github.com/test-owner/test-repo.git
url = https://github.com/test-owner/test-repo.git

Copilot uses AI. Check for mistakes.
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.

3 participants