Add use_repo_config parameter to automatically detect prettier configuration

This addresses GitHub issue #41 by adding an optional `use_repo_config` parameter
that allows the action to automatically detect and use the repository's prettier
configuration files and .prettierignore.

Changes:
- Added `use_repo_config` input parameter (default: false for backward compatibility)
- Implemented config file detection in entrypoint.sh for all prettier config formats
- Automatically changes file pattern to current directory when using repo config
- Provides helpful messages about found config files and warnings when none exist
- Updated README with new parameter documentation and Example 5

Benefits:
- Users no longer need to manually specify --config or --ignore-path
- Eliminates confusion about whether config files are being used
- Maintains backward compatibility (opt-in via parameter)
- Supports all prettier configuration file formats

Related: #41
This commit is contained in:
Claude
2025-11-17 15:40:12 +00:00
parent 68d6b720fe
commit a5f1df5578
3 changed files with 89 additions and 0 deletions

View File

@@ -77,6 +77,10 @@ inputs:
description: Allow other plugins to be installed. By default, we are checking if the plugins are actually prettier plugins.
required: false
default: false
use_repo_config:
description: Use the repository's prettier configuration files (.prettierrc, prettier.config.js, etc.) and .prettierignore automatically. When enabled, prettier will search for config files in the repository.
required: false
default: false
runs:
using: "composite"
@@ -106,6 +110,7 @@ runs:
INPUT_CLEAN_NODE_FOLDER: ${{ inputs.clean_node_folder }}
INPUT_GIT_IDENTITY: ${{ inputs.git_identity }}
INPUT_ALLOW_OTHER_PLUGINS: ${{ inputs.allow_other_plugins }}
INPUT_USE_REPO_CONFIG: ${{ inputs.use_repo_config }}
branding:
icon: "award"