mirror of
https://github.com/creyD/autopep8_action.git
synced 2026-04-14 20:30:32 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6995413f33 | |||
| b94a3d0b2b | |||
| fc2267b495 | |||
| 3b42b54814 | |||
| d36ec0e312 |
@@ -1,6 +1,6 @@
|
|||||||
FROM node:lts-alpine3.9
|
FROM python:3.11.3-slim-bullseye
|
||||||
|
|
||||||
RUN apk update && apk add --no-cache bash git openssh python py-pip
|
RUN apt update && apt install -y --no-install-recommends git
|
||||||
|
|
||||||
RUN pip install --no-cache-dir -q --upgrade pip
|
RUN pip install --no-cache-dir -q --upgrade pip
|
||||||
RUN pip install --no-cache-dir -q autopep8
|
RUN pip install --no-cache-dir -q autopep8
|
||||||
|
|||||||
21
README.md
21
README.md
@@ -1,9 +1,15 @@
|
|||||||
# GitHub autopep8 Action
|
# GitHub autopep8 Action
|
||||||
|
|
||||||
This action uses the newly released GitHub action to automatically restyle your Python code according to [PEP-8](https://www.python.org/dev/peps/pep-0008/) using [autopep8](https://github.com/hhatto/autopep8).
|
[](https://github.com/creyD/autopep8_action/blob/master/LICENSE)
|
||||||
|
[](https://github.com/creyD/autopep8_action/releases)
|
||||||
|
[](https://github.com/creyD/autopep8_action/graphs/contributors)
|
||||||
|
[](https://github.com/creyD/autopep8_action/issues)
|
||||||
|
|
||||||
|
This action automatically restyles Python code according to [PEP-8](https://www.python.org/dev/peps/pep-0008/) using [autopep8](https://github.com/hhatto/autopep8).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
The following parameters can be used in your custom action configuration.
|
The following parameters can be used in your custom action configuration.
|
||||||
|
|
||||||
| Parameter | Required | Default | Description |
|
| Parameter | Required | Default | Description |
|
||||||
@@ -12,9 +18,10 @@ 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` |
|
||||||
| checkpath | :x: | '.' | The path autopep8 checks |
|
| checkpath | :x: | '.' | The path autopep8 checks |
|
||||||
|
| no_commit | :x: | False | Avoid committing, if used in a pipeline |
|
||||||
| options | :x: | ' ' | Parameters to use with autopep8 |
|
| options | :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. |
|
||||||
|
| 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)
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
@@ -35,14 +42,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
# Make sure the actual branch is checked out when running on pull requests
|
# Make sure the actual branch is checked out when running on pull requests
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
- uses: creyD/action_autopep8@master
|
- uses: creyD/action_autopep8@v3.1
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Issues
|
## Issues
|
||||||
@@ -53,3 +57,6 @@ Please report all bugs and feature request using the [GitHub issues function](ht
|
|||||||
|
|
||||||
- Hideo Hattori [(GitHub)](https://github.com/hhatto) for creating and maintaining autopep8
|
- Hideo Hattori [(GitHub)](https://github.com/hhatto) for creating and maintaining autopep8
|
||||||
- Stefan Zweifel [(GitHub)](https://github.com/stefanzweifel) for providing an action to commit and push a git change
|
- Stefan Zweifel [(GitHub)](https://github.com/stefanzweifel) for providing an action to commit and push a git change
|
||||||
|
|
||||||
|
|
||||||
|
If you want you may also use my [autoflake](https://github.com/creyD/autoflake_action) and [prettier](https://github.com/creyD/prettier_action) GitHub actions.
|
||||||
|
|||||||
@@ -27,6 +27,14 @@ inputs:
|
|||||||
description: Should this script apply autopep8 directly or just warn?
|
description: Should this script apply autopep8 directly or just warn?
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
no_commit:
|
||||||
|
description: Can be used to avoid committing the changes
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
github_token:
|
||||||
|
description: GitHub Token or PAT token used to authenticate against a repository
|
||||||
|
required: false
|
||||||
|
default: ${{ github.token }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ _git_changed() {
|
|||||||
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!"
|
||||||
|
|
||||||
|
if $INPUT_NO_COMMIT; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if _git_changed;
|
if _git_changed;
|
||||||
then
|
then
|
||||||
if $INPUT_DRY; then
|
if $INPUT_DRY; then
|
||||||
|
|||||||
Reference in New Issue
Block a user