Skip to content

Commit 8bb01a9

Browse files
committed
feat: make install-pre-commit-hooks opt-in
1 parent f96d619 commit 8bb01a9

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

etc/kayobe/ansible/install-pre-commit-hooks.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22
- name: Install pre-commit hooks
33
hosts: localhost
44
gather_facts: false
5+
vars:
6+
enable_pre_commit_hooks: false
57
tasks:
6-
- name: Install pre-commit hooks into kayobe virtual env
7-
ansible.builtin.pip:
8-
name: pre-commit
9-
version: 3.5.0
10-
virtualenv: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}"
8+
- name: Install pre-commit hooks
9+
block:
10+
- name: Install pre-commit hooks into kayobe virtual env
11+
ansible.builtin.pip:
12+
name: pre-commit
13+
version: 3.5.0
14+
virtualenv: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}"
1115

12-
- name: Register pre-commit hooks with git
13-
ansible.builtin.command:
14-
cmd: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/bin/pre-commit install"
15-
creates: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}/../../.git/hooks/pre-commit"
16-
args:
17-
chdir: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}"
16+
- name: Register pre-commit hooks with git
17+
ansible.builtin.command:
18+
cmd: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/bin/pre-commit install"
19+
creates: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}/../../.git/hooks/pre-commit"
20+
args:
21+
chdir: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}"
22+
when: enable_pre_commit_hooks | default(false)

0 commit comments

Comments
 (0)