mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-16 21:30:31 +02:00
Merge pull request #57 from hpedrorodrigues/main
Small fixes for branch dev
This commit is contained in:
@@ -66,6 +66,7 @@ runs:
|
|||||||
INPUT_PRETTIER_VERSION: ${{ inputs.prettier_version }}
|
INPUT_PRETTIER_VERSION: ${{ inputs.prettier_version }}
|
||||||
INPUT_ONLY_CHANGED: ${{ inputs.only_changed }}
|
INPUT_ONLY_CHANGED: ${{ inputs.only_changed }}
|
||||||
INPUT_PRETTIER_PLUGINS: ${{ inputs.prettier_plugins }}
|
INPUT_PRETTIER_PLUGINS: ${{ inputs.prettier_plugins }}
|
||||||
|
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: "award"
|
icon: "award"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# e is for exiting the script automatically if a command fails, u is for exiting if a variable is not set
|
# e is for exiting the script automatically if a command fails, u is for exiting if a variable is not set
|
||||||
# x would be for showing the commands before they are executed
|
# x would be for showing the commands before they are executed
|
||||||
set -eu
|
set -eu
|
||||||
shopt -s globstar nullglob
|
shopt -s globstar
|
||||||
|
|
||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
# Function for setting up git env in the docker container (copied from https://github.com/stefanzweifel/git-auto-commit-action/blob/master/entrypoint.sh)
|
# Function for setting up git env in the docker container (copied from https://github.com/stefanzweifel/git-auto-commit-action/blob/master/entrypoint.sh)
|
||||||
@@ -63,11 +63,21 @@ fi
|
|||||||
PRETTIER_RESULT=0
|
PRETTIER_RESULT=0
|
||||||
echo "Prettifying files..."
|
echo "Prettifying files..."
|
||||||
echo "Files:"
|
echo "Files:"
|
||||||
prettier $INPUT_PRETTIER_OPTIONS || { PRETTIER_RESULT=$?; echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"; }
|
prettier $INPUT_PRETTIER_OPTIONS \
|
||||||
|
|| { PRETTIER_RESULT=$?; echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"; exit 1; }
|
||||||
|
|
||||||
# Ignore node modules and other action created files
|
# Ignore node modules and other action created files
|
||||||
rm -r node_modules/ || echo "No node_modules/ folder."
|
if [ -d 'node_modules' ]; then
|
||||||
git reset --hard package-lock.json || rm package-lock.json || echo "No package-lock.json file."
|
rm -r node_modules/
|
||||||
|
else
|
||||||
|
echo "No node_modules/ folder."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f 'package-lock.json' ]; then
|
||||||
|
git reset --hard package-lock.json || rm package-lock.json
|
||||||
|
else
|
||||||
|
echo "No package-lock.json file."
|
||||||
|
fi
|
||||||
|
|
||||||
# To keep runtime good, just continue if something was changed
|
# To keep runtime good, just continue if something was changed
|
||||||
if _git_changed; then
|
if _git_changed; then
|
||||||
@@ -100,7 +110,7 @@ if _git_changed; then
|
|||||||
git push origin -f
|
git push origin -f
|
||||||
else
|
else
|
||||||
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"} || echo "No files added to commit"
|
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"} || echo "No files added to commit"
|
||||||
git push origin $INPUT_PUSH_OPTIONS
|
git push origin ${INPUT_PUSH_OPTIONS:-}
|
||||||
fi
|
fi
|
||||||
echo "Changes pushed successfully."
|
echo "Changes pushed successfully."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user