mirror of
https://github.com/creyD/autopep8_action.git
synced 2026-04-12 19:40:28 +02:00
Minor Cleanup
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# MacOS system files
|
||||||
|
.DS_Store
|
||||||
@@ -23,6 +23,8 @@ The following parameters can be used in your custom action configuration.
|
|||||||
| dry | :x: | false | Dry-run the action to fail when detecting PEP-8 uncompliant files, instead of automatically fixing them. |
|
| dry | :x: | false | Dry-run the action to fail when detecting PEP-8 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)
|
| 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
|
### Example
|
||||||
|
|
||||||
This is a simple usage example of this script:
|
This is a simple usage example of this script:
|
||||||
@@ -49,6 +51,8 @@ jobs:
|
|||||||
- uses: creyD/action_autopep8@v3.1
|
- uses: creyD/action_autopep8@v3.1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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
|
## Issues
|
||||||
|
|
||||||
Please report all bugs and feature request using the [GitHub issues function](https://github.com/creyD/autopep8_action/issues/new).
|
Please report all bugs and feature request using the [GitHub issues function](https://github.com/creyD/autopep8_action/issues/new).
|
||||||
|
|||||||
@@ -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
|
# 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
|
||||||
|
|
||||||
# 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)
|
||||||
@@ -25,6 +26,14 @@ _git_changed() {
|
|||||||
[[ -n "$(git status -s)" ]]
|
[[ -n "$(git status -s)" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_git_changes() {
|
||||||
|
git diff
|
||||||
|
}
|
||||||
|
|
||||||
|
# PROGRAM
|
||||||
|
# Changing to the directory
|
||||||
|
cd "$GITHUB_ACTION_PATH"
|
||||||
|
|
||||||
echo "Running autopep8..."
|
echo "Running autopep8..."
|
||||||
autopep8 -i -r $INPUT_CHECKPATH $INPUT_OPTIONS || echo "Problem running autopep8!"
|
autopep8 -i -r $INPUT_CHECKPATH $INPUT_OPTIONS || echo "Problem running autopep8!"
|
||||||
|
|
||||||
@@ -35,7 +44,9 @@ fi
|
|||||||
if _git_changed;
|
if _git_changed;
|
||||||
then
|
then
|
||||||
if $INPUT_DRY; then
|
if $INPUT_DRY; then
|
||||||
echo "Found non-compliant files!"
|
echo "Found non-compliant files:"
|
||||||
|
_git_changes
|
||||||
|
echo "Finishing dry-run. Exiting before committing."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# Calling method to configure the git environemnt
|
# Calling method to configure the git environemnt
|
||||||
|
|||||||
Reference in New Issue
Block a user