mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-14 20:30:30 +02:00
Experimenting with a simpler form of composite actions
This commit is contained in:
29
action.yml
29
action.yml
@@ -7,7 +7,7 @@ inputs:
|
|||||||
commit_message:
|
commit_message:
|
||||||
description: Commit message, will be ignored if used with same_commit
|
description: Commit message, will be ignored if used with same_commit
|
||||||
required: false
|
required: false
|
||||||
default: 'Prettified Code!'
|
default: "Prettified Code!"
|
||||||
same_commit:
|
same_commit:
|
||||||
description: Update the current commit instead of creating a new one
|
description: Update the current commit instead of creating a new one
|
||||||
required: false
|
required: false
|
||||||
@@ -18,11 +18,11 @@ inputs:
|
|||||||
file_pattern:
|
file_pattern:
|
||||||
description: File pattern used for `git add`, can't be used with only_changed!
|
description: File pattern used for `git add`, can't be used with only_changed!
|
||||||
required: false
|
required: false
|
||||||
default: '*'
|
default: "*"
|
||||||
prettier_options:
|
prettier_options:
|
||||||
description: Options for the `prettier` command
|
description: Options for the `prettier` command
|
||||||
required: false
|
required: false
|
||||||
default: '--write **/*.js'
|
default: "--write **/*.js"
|
||||||
dry:
|
dry:
|
||||||
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
|
||||||
@@ -38,26 +38,15 @@ inputs:
|
|||||||
prettier_plugins:
|
prettier_plugins:
|
||||||
description: Install Prettier plugins, i.e. `@prettier/prettier-php @prettier/some-other-plugin`
|
description: Install Prettier plugins, i.e. `@prettier/prettier-php @prettier/some-other-plugin`
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ""
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: prettier
|
- name: Prettify code!
|
||||||
shell: bash
|
shell: bash
|
||||||
run: >-
|
run: ${{ github.action_path }}/entrypoint.sh
|
||||||
PATH=$(cd $GITHUB_ACTION_PATH; npm bin):$PATH
|
|
||||||
INPUT_COMMIT_MESSAGE="${{ inputs.commit_message }}"
|
|
||||||
INPUT_COMMIT_OPTIONS="${{ inputs.commit_options }}"
|
|
||||||
INPUT_DRY="${{ inputs.dry }}"
|
|
||||||
INPUT_FILE_PATTERN="${{ inputs.file_pattern }}"
|
|
||||||
INPUT_ONLY_CHANGED="${{ inputs.only_changed }}"
|
|
||||||
INPUT_PRETTIER_OPTIONS="${{ inputs.prettier_options }}"
|
|
||||||
INPUT_PRETTIER_PLUGINS="${{ inputs.prettier_plugins }}"
|
|
||||||
INPUT_PRETTIER_VERSION="${{ inputs.prettier_version }}"
|
|
||||||
INPUT_SAME_COMMIT="${{ inputs.same_commit }}"
|
|
||||||
$GITHUB_ACTION_PATH/entrypoint.sh
|
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: 'award'
|
icon: "award"
|
||||||
color: 'green'
|
color: "green"
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ fi
|
|||||||
echo "Installing prettier..."
|
echo "Installing prettier..."
|
||||||
case $INPUT_PRETTIER_VERSION in
|
case $INPUT_PRETTIER_VERSION in
|
||||||
false)
|
false)
|
||||||
npm install --silent $maybe_global prettier
|
npm install --silent -g prettier
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
npm install --silent $maybe_global prettier@$INPUT_PRETTIER_VERSION
|
npm install --silent -g prettier@$INPUT_PRETTIER_VERSION
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user