Removed branch parameter

This commit is contained in:
2020-05-06 10:13:24 +02:00
parent 552eff98a5
commit 8fa1e16ff1
3 changed files with 18 additions and 23 deletions

View File

@@ -12,7 +12,6 @@ The following parameters can be used in your custom action configuration.
| commit_options | :x: | - | Custom git commit options|
| 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.|
| 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 |
| 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. |

View File

@@ -19,9 +19,6 @@ inputs:
description: Path for the repositories 'requirements.txt'. If you have none, you may skip this.
required: false
default: 'requirements.txt'
branch:
description: Branch which the changes are merged to
required: true
checkpath:
description: Path autopep8 checks
required: false
@@ -38,14 +35,6 @@ inputs:
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.commit_message }}
- ${{ inputs.commit_options }}
- ${{ inputs.file_pattern }}
- ${{ inputs.dependencies }}
- ${{ inputs.branch }}
- ${{ inputs.checkpath }}
- ${{ inputs.autoparameters }}
branding:
icon: 'fast-forward'

View File

@@ -1,21 +1,28 @@
#!/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
# 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)
git_setup ( ) {
cat <<- EOF > $HOME/.netrc
machine github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
machine api.github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
_git_setup ( ) {
cat <<- EOF > $HOME/.netrc
machine github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
machine api.github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
EOF
chmod 600 $HOME/.netrc
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..."
@@ -30,7 +37,7 @@ pip install -r $INPUT_DEPENDENCIES || echo "No dependency file found."
echo "Running autopep8..."
autopep8 -i -r $INPUT_CHECKPATH $INPUT_AUTOPARAMETERS || echo "Problem running autopep8!"
if ! git diff --quiet
if _git_changed;
then
if $INPUT_DRY; then
echo "Found non-compliant files!"