Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/creyd/autoflake_action
Automatically runs the autoflake command against any commit/ pull request created
https://github.com/creyd/autoflake_action
actions automation flake8 github-actions python python3
Last synced: 15 days ago
JSON representation
Automatically runs the autoflake command against any commit/ pull request created
- Host: GitHub
- URL: https://github.com/creyd/autoflake_action
- Owner: creyD
- License: mit
- Created: 2023-05-23T09:36:21.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-05-24T09:09:05.000Z (over 1 year ago)
- Last Synced: 2024-11-14T16:49:39.772Z (3 months ago)
- Topics: actions, automation, flake8, github-actions, python, python3
- Language: Shell
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# GitHub autoflake Action
[![License MIT](https://img.shields.io/github/license/creyD/autoflake_action)](https://github.com/creyD/autoflake_action/blob/master/LICENSE)
[![Latest Release](https://img.shields.io/github/v/release/creyD/autoflake_action)](https://github.com/creyD/autoflake_action/releases)
[![Contributors](https://img.shields.io/github/contributors-anon/creyD/autoflake_action)](https://github.com/creyD/autoflake_action/graphs/contributors)
[![Issues](https://img.shields.io/github/issues/creyD/autoflake_action)](https://github.com/creyD/autoflake_action/issues)This GitHub action automatically removes unused imports and variables from your Python code using [autoflake](https://pypi.org/project/autoflake/).
## Usage
### Parameters
The following parameters can be used in your custom action configuration.| Parameter | Required | Default | Description |
| - | - | - | - |
| commit_message | :x: | 'Removed unused imports and variables' | Custom git commit message |
| commit_options | :x: | - | Custom git commit options |
| file_pattern | :x: | '*' | Custom file pattern for `git add` |
| checkpath | :x: | '.' | The path autoflake checks |
| no_commit | :x: | False | Avoid committing, if used in a pipeline |
| options | :x: | ' ' | Parameters to use with autoflake |
| 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:
```yaml
name: autoflake formaton:
pull_request:
push:
branches:
- masterjobs:
format:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v3
- uses: creyD/[email protected]
with:
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).
## FAQ
### Repository workflow settings
To be able to push to your repository you will need to enable "Read and write permissions" for your repository. You can find these settings in the settings of the repository under Actions > General > Workflow Permissions.
![Workflow Permissions](https://github.com/creyD/autoflake_action/assets/15138480/05d5d993-970f-4835-bfeb-2d067afcf352)
If you do not set this, you might encounter this issue:
![Sample error message](https://github.com/creyD/autoflake_action/assets/15138480/e71c814f-e7e9-4636-973b-750d6b950b84)