├── .github └── dependabot.yml ├── Dockerfile ├── LICENSE ├── README.md ├── entrypoint.sh └── requirements.txt /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | registries: 3 | python-index-pypi-python-org-simple: 4 | type: python-index 5 | url: https://pypi.python.org/simple/ 6 | 7 | updates: 8 | - package-ecosystem: pip 9 | directory: "/" 10 | schedule: 11 | interval: daily 12 | time: "07:00" 13 | timezone: Europe/Stockholm 14 | open-pull-requests-limit: 10 15 | ignore: 16 | - dependency-name: black 17 | versions: 18 | - 20.8b1 19 | registries: 20 | - python-index-pypi-python-org-simple 21 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7 2 | 3 | LABEL "com.github.actions.name"="Python style check" 4 | LABEL "com.github.actions.description"="Checks repository against isort, flake8 and black" 5 | LABEL "com.github.actions.icon"="code" 6 | LABEL "com.github.actions.color"="blue" 7 | 8 | LABEL "repository"="https://github.com/bulv1ne/python-style-check" 9 | LABEL "homepage"="https://github.com/bulv1ne/python-style-check" 10 | LABEL "maintainer"="Niels Lemmens " 11 | 12 | ADD requirements.txt /requirements.txt 13 | ADD entrypoint.sh /entrypoint.sh 14 | 15 | RUN pip install -r requirements.txt 16 | 17 | ENTRYPOINT ["/entrypoint.sh"] 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Niels Lemmens 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # python-style-check 2 | GitHub Action for isort, flake8 and black 3 | 4 | ## Usage 5 | 6 | Example workflow to test python style: 7 | 8 | ```hcl 9 | workflow "Style check on push" { 10 | on = "push" 11 | resolves = ["Style check"] 12 | } 13 | 14 | action "Style check" { 15 | uses = "bulv1ne/python-style-check@master" 16 | } 17 | ``` 18 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eax 4 | 5 | DIR=${1:-.} 6 | cd $DIR 7 | 8 | if [ -f Pipfile ] 9 | then 10 | pip install -U pipenv 11 | pipenv install -d --system 12 | elif [ -f requirements.txt ] 13 | then 14 | pip install -r requirements.txt 15 | fi 16 | 17 | 18 | isort --version-number 19 | isort . --check --diff 20 | 21 | black --version 22 | black --check --exclude '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist|node_modules)/' . 23 | 24 | flake8 --version 25 | flake8 --ignore E501,W503 --exclude .venv 26 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | black==21.5b0 2 | flake8 3 | isort>=5,<6 4 | --------------------------------------------------------------------------------