13 Commits
v2.1 ... v2.2

Author SHA1 Message Date
8295f2c348 Merge pull request #11 from creyD/dev_version
Added npm Version Selection
2020-03-24 10:07:02 +01:00
897359d7a2 Update entrypoint.sh 2020-03-24 10:00:40 +01:00
65e822b2f3 New Parameter Defaults To Null 2020-03-24 09:56:43 +01:00
565d7a7458 Attempt 2 on fixing the bug with the new version parameter 2020-03-24 09:51:18 +01:00
66441c9ff3 Fixed bug with new version parameter 2020-03-24 09:46:35 +01:00
28d6dc7fe1 Merge pull request #10 from creyD/dev_badges
Stepped Up Badge Game
2020-03-24 00:28:16 +01:00
158b31956c Stepped Up Badge Game 2020-03-24 00:26:22 +01:00
e0fb4eb439 Added prettier_version parameter 2020-03-24 00:15:08 +01:00
d8862e43c9 Added Prettier Badge to Readme 2020-03-24 00:10:16 +01:00
857b4b338e Bumped other version in Readme 2020-03-20 17:44:02 +01:00
0c51fd6dc9 Merge pull request #7 from TomBarta/patch-1
Update README to match latest version
2020-03-20 17:39:29 +01:00
Tom Barta
9bca767580 Update README to match latest version 2020-03-20 10:28:35 -06:00
0d1a062a13 Marked Importance 2020-03-18 11:12:34 +01:00
3 changed files with 18 additions and 4 deletions

View File

@@ -1,6 +1,12 @@
# GitHub Prettier Action # GitHub Prettier Action
[![CodeFactor](https://www.codefactor.io/repository/github/creyd/prettier_action/badge/master)](https://www.codefactor.io/repository/github/creyd/prettier_action/overview/master) [![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). A GitHub action for styling files with [prettier](https://prettier.io).
@@ -11,6 +17,7 @@ A GitHub action for styling files with [prettier](https://prettier.io).
| Parameter | Required | Default | Description | | 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. | | 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) | | prettier_options | :x: | `--write **/*.js` | Prettier options (by default it applies to the whole repository) |
| commit_options | :x: | - | Custom git commit options | | commit_options | :x: | - | Custom git commit options |
| commit_message | :x: | Prettified Code! | Custom git commit message | | commit_message | :x: | Prettified Code! | Custom git commit message |
@@ -38,7 +45,7 @@ jobs:
with: with:
fetch-depth: 1 fetch-depth: 1
- name: Prettify the JS Code - name: Prettify the JS Code
uses: creyD/prettier_action@v2.0 uses: creyD/prettier_action@v2.1
with: with:
prettier_options: '--no-semi --write *.js' prettier_options: '--no-semi --write *.js'
branch: ${{ github.head_ref }} branch: ${{ github.head_ref }}
@@ -65,7 +72,7 @@ jobs:
with: with:
fetch-depth: 1 fetch-depth: 1
- name: Prettify the JS Code - name: Prettify the JS Code
uses: creyD/prettier_action@v2.0 uses: creyD/prettier_action@v2.1
with: with:
prettier_options: '--no-semi --write *.js' prettier_options: '--no-semi --write *.js'
branch: master branch: master

View File

@@ -26,6 +26,9 @@ inputs:
description: Running the script in dry mode just shows whether there are files that should be prettified or not description: Running the script in dry mode just shows whether there are files that should be prettified or not
required: false required: false
default: False default: False
prettier_version:
description: Specific version of prettier (by default just use the latest version)
required: false
runs: runs:
using: 'docker' using: 'docker'

View File

@@ -37,7 +37,11 @@ _git_push() {
# PROGRAM # PROGRAM
echo "Installing prettier..." 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 "Prettifing files..."
echo "Files:" echo "Files:"
@@ -47,7 +51,7 @@ prettier $INPUT_PRETTIER_OPTIONS || echo "Problem running prettier with $INPUT_P
if _git_changed; if _git_changed;
then then
if $INPUT_DRY; then if $INPUT_DRY; then
echo "Prettier found unpretty files." echo "Prettier found unpretty files!"
exit 1 exit 1
else else
# Calling method to configure the git environemnt # Calling method to configure the git environemnt