Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grantmcconnaughey/lintly-flake8-github-action
A GitHub Action that lints Python code with Flake8 then automatically creates pull request reviews if there are any violations.
https://github.com/grantmcconnaughey/lintly-flake8-github-action
continuous-integration flake8 github-actions linting python
Last synced: 12 days ago
JSON representation
A GitHub Action that lints Python code with Flake8 then automatically creates pull request reviews if there are any violations.
- Host: GitHub
- URL: https://github.com/grantmcconnaughey/lintly-flake8-github-action
- Owner: grantmcconnaughey
- License: mit
- Created: 2020-01-05T19:01:21.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-04-20T15:02:31.000Z (over 2 years ago)
- Last Synced: 2024-11-15T22:41:09.028Z (about 1 month ago)
- Topics: continuous-integration, flake8, github-actions, linting, python
- Language: Dockerfile
- Homepage:
- Size: 160 KB
- Stars: 24
- Watchers: 2
- Forks: 17
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lintly-Flake8 GitHub Action
A GitHub Action that lints Python code with Flake8 then automatically creates pull request reviews if there are any violations. Uses [Lintly](http://github.com/grantmcconnaughey/Lintly) under the hood.
See [this pull request](https://github.com/grantmcconnaughey/lintly-flake8-github-action/pull/1#pullrequestreview-338419294) for an example.
## Usage
To use Lintly-Flake8 GitHub Action, add the following to a GitHub Actions workflow file such as `.github/workflows/main.yml`:
```yaml
on: [pull_request]jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: grantmcconnaughey/[email protected]
with:
# The GitHub API token to create reviews with
token: ${{ secrets.GITHUB_TOKEN }}
# Fail if "new" violations detected or "any", default "new"
failIf: new
# Additional arguments to pass to flake8, default "." (current directory)
args: "--ignore=E121,E123 ."
```Now each PR created will be linted with Flake8. If there are any violations then Lintly will comment on the PR using the `github-actions` bot user.
![Lintly example](example.png)
**Note:** Lintly-Flake8 only works with the `pull_request` event. If your job runs on the `push` event then make sure the Lintly-Flake8 step only runs on the pull request event by adding `if: github.event_name == 'pull_request'`:
```yaml
- uses: grantmcconnaughey/[email protected]
if: github.event_name == 'pull_request'
```