mirror of
https://github.com/haidaraM/ansible-playbook-grapher
synced 2024-11-10 06:04:15 +00:00
ci: Trigger black on python file changes only + autocommit (#139)
Co-authored-by: haidaraM <haidaraM@users.noreply.github.com>
This commit is contained in:
parent
68e137e762
commit
84d759d70c
5 changed files with 23 additions and 3 deletions
19
.github/workflows/lint.yml
vendored
19
.github/workflows/lint.yml
vendored
|
@ -4,15 +4,32 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '**.py'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '**.py'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
black:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: psf/black@stable
|
||||
with:
|
||||
options: "--check --diff --color"
|
||||
version: "~= 23.0" # https://black.readthedocs.io/en/stable/integrations/github_actions.html
|
||||
options: ""
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: Autoformat code using black
|
||||
|
|
|
@ -202,6 +202,10 @@ The graphs are generated in the folder `tests/generated-svgs`. They are also gen
|
|||
in [Github Actions](https://github.com/haidaraM/ansible-playbook-grapher/actions). Feel free to look at them when
|
||||
submitting PRs.
|
||||
|
||||
### Lint and format
|
||||
|
||||
The project uses black to format the code. Run `black .` to format.
|
||||
|
||||
## License
|
||||
|
||||
GNU General Public License v3.0 or later (Same as Ansible)
|
||||
|
|
|
@ -45,7 +45,6 @@ OPEN_PROTOCOL_HANDLERS = {
|
|||
class Grapher:
|
||||
def __init__(self, playbook_filenames: List[str]):
|
||||
"""
|
||||
|
||||
:param playbook_filenames: List of playbooks to graph
|
||||
"""
|
||||
self.playbook_filenames = playbook_filenames
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
pytest==7.1.3
|
||||
pytest-cov==4.0.0
|
||||
pyquery==2.0.0
|
||||
black~=23.0
|
|
@ -43,7 +43,6 @@ def test_get_all_tasks_nodes():
|
|||
:return:
|
||||
"""
|
||||
play = PlayNode("play")
|
||||
|
||||
role_1 = RoleNode("my_role_1")
|
||||
play.add_node("roles", role_1)
|
||||
|
||||
|
|
Loading…
Reference in a new issue