mirror of
https://github.com/creyD/autopep8_action.git
synced 2026-04-17 05:40:32 +02:00
Removed branch parameter
This commit is contained in:
@@ -12,7 +12,6 @@ The following parameters can be used in your custom action configuration.
|
|||||||
| commit_options | :x: | - | Custom git commit options|
|
| commit_options | :x: | - | Custom git commit options|
|
||||||
| file_pattern | :x: | '*' | Custom file pattern for `git add`|
|
| file_pattern | :x: | '*' | Custom file pattern for `git add`|
|
||||||
| dependencies | :x: | 'requirements.txt' | Path for the repositories 'requirements.txt'. If you have none, you may skip this.|
|
| dependencies | :x: | 'requirements.txt' | Path for the repositories 'requirements.txt'. If you have none, you may skip this.|
|
||||||
| branch | :white_check_mark: | - | The specific branch you want to merge into. Use ${{ github.head_ref }} if you want to use this with pull requests. |
|
|
||||||
| checkpath | :x: | '.' | The path autopep8 checks |
|
| checkpath | :x: | '.' | The path autopep8 checks |
|
||||||
| autoparameters | :x: | ' ' | Parameters to use with autopep8 |
|
| autoparameters | :x: | ' ' | Parameters to use with autopep8 |
|
||||||
| 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. |
|
||||||
|
|||||||
11
action.yml
11
action.yml
@@ -19,9 +19,6 @@ inputs:
|
|||||||
description: Path for the repositories 'requirements.txt'. If you have none, you may skip this.
|
description: Path for the repositories 'requirements.txt'. If you have none, you may skip this.
|
||||||
required: false
|
required: false
|
||||||
default: 'requirements.txt'
|
default: 'requirements.txt'
|
||||||
branch:
|
|
||||||
description: Branch which the changes are merged to
|
|
||||||
required: true
|
|
||||||
checkpath:
|
checkpath:
|
||||||
description: Path autopep8 checks
|
description: Path autopep8 checks
|
||||||
required: false
|
required: false
|
||||||
@@ -38,14 +35,6 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
args:
|
|
||||||
- ${{ inputs.commit_message }}
|
|
||||||
- ${{ inputs.commit_options }}
|
|
||||||
- ${{ inputs.file_pattern }}
|
|
||||||
- ${{ inputs.dependencies }}
|
|
||||||
- ${{ inputs.branch }}
|
|
||||||
- ${{ inputs.checkpath }}
|
|
||||||
- ${{ inputs.autoparameters }}
|
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: 'fast-forward'
|
icon: 'fast-forward'
|
||||||
|
|||||||
@@ -1,21 +1,28 @@
|
|||||||
#!/bin/sh -l
|
#!/bin/sh -l
|
||||||
|
# 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
|
set -eu
|
||||||
|
|
||||||
|
# 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)
|
||||||
git_setup ( ) {
|
_git_setup ( ) {
|
||||||
cat <<- EOF > $HOME/.netrc
|
cat <<- EOF > $HOME/.netrc
|
||||||
machine github.com
|
machine github.com
|
||||||
login $GITHUB_ACTOR
|
login $GITHUB_ACTOR
|
||||||
password $GITHUB_TOKEN
|
password $GITHUB_TOKEN
|
||||||
machine api.github.com
|
machine api.github.com
|
||||||
login $GITHUB_ACTOR
|
login $GITHUB_ACTOR
|
||||||
password $GITHUB_TOKEN
|
password $GITHUB_TOKEN
|
||||||
EOF
|
EOF
|
||||||
chmod 600 $HOME/.netrc
|
chmod 600 $HOME/.netrc
|
||||||
|
|
||||||
git config --global user.email "actions@github.com"
|
git config --global user.email "actions@github.com"
|
||||||
git config --global user.name "GitHub Actions"
|
git config --global user.name "GitHub Action"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Checks if any files are changed
|
||||||
|
_git_changed() {
|
||||||
|
[[ -n "$(git status -s)" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Installing dependencies..."
|
echo "Installing dependencies..."
|
||||||
@@ -30,7 +37,7 @@ pip install -r $INPUT_DEPENDENCIES || echo "No dependency file found."
|
|||||||
echo "Running autopep8..."
|
echo "Running autopep8..."
|
||||||
autopep8 -i -r $INPUT_CHECKPATH $INPUT_AUTOPARAMETERS || echo "Problem running autopep8!"
|
autopep8 -i -r $INPUT_CHECKPATH $INPUT_AUTOPARAMETERS || echo "Problem running autopep8!"
|
||||||
|
|
||||||
if ! git diff --quiet
|
if _git_changed;
|
||||||
then
|
then
|
||||||
if $INPUT_DRY; then
|
if $INPUT_DRY; then
|
||||||
echo "Found non-compliant files!"
|
echo "Found non-compliant files!"
|
||||||
|
|||||||
Reference in New Issue
Block a user