diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..166a4ec --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# MacOS system files +.DS_Store diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..73f12e0 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Code of Conduct + +Be excellent to each other. diff --git a/README.md b/README.md index b076e64..a493d94 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ The following parameters can be used in your custom action configuration. | dry | :x: | false | Dry-run the action to fail when detecting uncompliant files, instead of automatically fixing them. | | github_token | :x: | `${{ github.token }}` | The default [GITHUB_TOKEN](https://docs.github.com/en/actions/reference/authentication-in-a-workflow#about-the-github_token-secret) or a [Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) +> Note: using the same_commit option may lead to problems if other actions are relying on the commit being the same before and after the prettier action has ran. Keep this in mind. + ### Example This is a simple usage example of this script: @@ -46,6 +48,8 @@ jobs: options: --in-place --remove-all-unused-imports -r ``` +More documentation for writing a workflow can be found [here](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions). + ## Issues Please report all bugs and feature request using the [GitHub issues function](https://github.com/creyD/autoflake_action/issues/new). diff --git a/entrypoint.sh b/entrypoint.sh index dbe8a93..44ff4c6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,6 +2,7 @@ # 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 set -eu +shopt -s globstar # 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) @@ -25,6 +26,10 @@ _git_changed() { [[ -n "$(git status -s)" ]] } +_git_changes() { + git diff +} + git config --global --add safe.directory /github/workspace echo "Running autoflake..." @@ -37,7 +42,9 @@ fi if _git_changed; then if $INPUT_DRY; then - echo "Found non-compliant files!" + echo "Unpretty Files Changes:" + _git_changes + echo "Finishing dry-run. Exiting before committing." exit 1 else # Calling method to configure the git environemnt