Skip to content

Commit 8295f2c

Browse files
authored
Merge pull request #11 from creyD/dev_version
Added npm Version Selection
2 parents d8862e4 + 897359d commit 8295f2c

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

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

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

@@ -12,6 +17,7 @@ A GitHub action for styling files with [prettier](https://prettier.io).
1217
| Parameter | Required | Default | Description |
1318
| - | :-: | :-: | - |
1419
| dry | :x: | False | Runs the action in dry mode. Files wont get changed and the action fails if there are unprettified files. |
20+
| prettier_version | :x: | False | Specific prettier version (by default use latest) |
1521
| prettier_options | :x: | `--write **/*.js` | Prettier options (by default it applies to the whole repository) |
1622
| commit_options | :x: | - | Custom git commit options |
1723
| commit_message | :x: | Prettified Code! | Custom git commit message |

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ inputs:
2626
description: Running the script in dry mode just shows whether there are files that should be prettified or not
2727
required: false
2828
default: False
29+
prettier_version:
30+
description: Specific version of prettier (by default just use the latest version)
31+
required: false
2932

3033
runs:
3134
using: 'docker'

entrypoint.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ _git_push() {
3737

3838
# PROGRAM
3939
echo "Installing prettier..."
40-
npm install --silent --global prettier
40+
if "$INPUT_PRETTIER_VERSION"; then
41+
npm install --silent --global prettier@$INPUT_PRETTIER_VERSION
42+
else
43+
npm install --silent --global prettier
44+
fi
4145

4246
echo "Prettifing files..."
4347
echo "Files:"

0 commit comments

Comments
 (0)