mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-12 19:30:30 +02:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8295f2c348 | |||
| 897359d7a2 | |||
| 65e822b2f3 | |||
| 565d7a7458 | |||
| 66441c9ff3 | |||
| 28d6dc7fe1 | |||
| 158b31956c | |||
| e0fb4eb439 | |||
| d8862e43c9 | |||
| 857b4b338e | |||
| 0c51fd6dc9 | |||
|
|
9bca767580 | ||
| 0d1a062a13 |
11
README.md
11
README.md
@@ -1,6 +1,12 @@
|
||||
# GitHub Prettier Action
|
||||
|
||||
[](https://www.codefactor.io/repository/github/creyd/prettier_action/overview/master)
|
||||
[](https://github.com/prettier/prettier)
|
||||
[](https://github.com/creyD/prettier_action/blob/master/LICENSE)
|
||||
[](https://github.com/creyD/prettier_action/releases)
|
||||
[](https://github.com/creyD/prettier_action/graphs/contributors)
|
||||
[](https://github.com/creyD/prettier_action/issues)
|
||||
|
||||
|
||||
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 |
|
||||
| - | :-: | :-: | - |
|
||||
| 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 |
|
||||
@@ -38,7 +45,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Prettify the JS Code
|
||||
uses: creyD/prettier_action@v2.0
|
||||
uses: creyD/prettier_action@v2.1
|
||||
with:
|
||||
prettier_options: '--no-semi --write *.js'
|
||||
branch: ${{ github.head_ref }}
|
||||
@@ -65,7 +72,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Prettify the JS Code
|
||||
uses: creyD/prettier_action@v2.0
|
||||
uses: creyD/prettier_action@v2.1
|
||||
with:
|
||||
prettier_options: '--no-semi --write *.js'
|
||||
branch: master
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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:"
|
||||
@@ -47,7 +51,7 @@ prettier $INPUT_PRETTIER_OPTIONS || echo "Problem running prettier with $INPUT_P
|
||||
if _git_changed;
|
||||
then
|
||||
if $INPUT_DRY; then
|
||||
echo "Prettier found unpretty files."
|
||||
echo "Prettier found unpretty files!"
|
||||
exit 1
|
||||
else
|
||||
# Calling method to configure the git environemnt
|
||||
|
||||
Reference in New Issue
Block a user