Skip to content

Commit

Permalink
Merge pull request #11 from creyD/dev_version
Browse files Browse the repository at this point in the history
Added npm Version Selection
  • Loading branch information
creyD authored Mar 24, 2020
2 parents d8862e4 + 897359d commit 8295f2c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

[![CodeFactor](https://www.codefactor.io/repository/github/creyd/prettier_action/badge/master)](https://www.codefactor.io/repository/github/creyd/prettier_action/overview/master)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![License MIT](https://img.shields.io/github/license/creyD/prettier_action)](https://github.com/creyD/prettier_action/blob/master/LICENSE)
[![Latest Release](https://img.shields.io/github/v/release/creyD/prettier_action)](https://github.com/creyD/prettier_action/releases)
[![Contributors](https://img.shields.io/github/contributors-anon/creyD/prettier_action)](https://github.com/creyD/prettier_action/graphs/contributors)
[![Issues](https://img.shields.io/github/issues/creyD/prettier_action)](https://github.com/creyD/prettier_action/issues)


A GitHub action for styling files with [prettier](https://prettier.io).

Expand All @@ -12,6 +17,7 @@ A GitHub action for styling files with [prettier](https://prettier.io).
| Parameter | Required | Default | Description |
| - | :-: | :-: | - |
| dry | :x: | False | Runs the action in dry mode. Files wont get changed and the action fails if there are unprettified files. |
| prettier_version | :x: | False | Specific prettier version (by default use latest) |
| prettier_options | :x: | `--write **/*.js` | Prettier options (by default it applies to the whole repository) |
| commit_options | :x: | - | Custom git commit options |
| commit_message | :x: | Prettified Code! | Custom git commit message |
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ inputs:
description: Running the script in dry mode just shows whether there are files that should be prettified or not
required: false
default: False
prettier_version:
description: Specific version of prettier (by default just use the latest version)
required: false

runs:
using: 'docker'
Expand Down
6 changes: 5 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ _git_push() {

# PROGRAM
echo "Installing prettier..."
npm install --silent --global prettier
if "$INPUT_PRETTIER_VERSION"; then
npm install --silent --global prettier@$INPUT_PRETTIER_VERSION
else
npm install --silent --global prettier
fi

echo "Prettifing files..."
echo "Files:"
Expand Down

0 comments on commit 8295f2c

Please sign in to comment.