forked from osism/github-manager
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapply_repository.yaml
105 lines (101 loc) · 4.71 KB
/
apply_repository.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
- name: Initialize variables
set_fact:
repo_branch_protections: []
- name: Substitute branch protection template with the content
set_fact:
repo_branch_protections: "{{
repo_branch_protections +
[ org.branch_protection_templates[zj_bp.template] | combine({'branch': zj_bp['branch']}) ]
}}"
loop: "{{ repo.branch_protections }}"
loop_control:
loop_var: "zj_bp"
when:
- "repo.branch_protections is defined"
- "'template' in zj_bp"
- name: Append original (non template) branch protections
set_fact:
repo_branch_protections: "{{
repo_branch_protections +
[zj_bp]
}}"
loop: "{{ repo.branch_protections }}"
loop_control:
loop_var: "zj_bp"
when:
- "repo.branch_protections is defined"
- "'template' not in zj_bp"
- name: "Apply repository {{ repo_name }}"
opentelekomcloud.gitcontrol.github_org_repository:
token: "{{ api_token }}"
owner: "{{ organization }}"
name: "{{ repo.name | default(repo_name) }}"
state: "{{ repo.state | default('present') }}"
description: "{{ repo.description | default(omit) }}"
homepage: "{{ repo.homepage | default(omit) }}"
archived: "{{ repo.archived | default(omit) }}"
has_issues: "{{ repo.has_issues | default(omit) }}"
has_projects: "{{ repo.has_projects | default(omit) }}"
has_wiki: "{{ repo.has_wiki | default(omit) }}"
private: "{{ repo.private | default(omit) }}"
visibility: "{{ repo.visibility | default(omit) }}"
is_template: "{{ repo.is_template | default(omit) }}"
auto_init: "{{ repo.auto_init | default(omit) }}"
gitignore_template: "{{ repo.gitignore_template | default(omit) }}"
license_template: "{{ repo.license_template | default(omit) }}"
allow_forking: "{{ repo.allow_forking | default(omit) }}"
allow_squash_merge: "{{ repo.allow_squash_merge | default(omit) }}"
allow_merge_commit: "{{ repo.allow_merge_commit | default(omit) }}"
allow_rebase_merge: "{{ repo.allow_rebase_merge | default(omit) }}"
allow_auto_merge: "{{ repo.allow_auto_merge | default(omit) }}"
delete_branch_on_merge: "{{ repo.delete_branch_on_merge | default(omit) }}"
default_branch: "{{ repo.default_branch | default(omit) }}"
topics: "{{ repo.topics | default(omit) }}"
teams: "{{ repo.teams | default(omit) }}"
collaborators: "{{ repo.collaborators | default(omit) }}"
branch_protections: "{{ repo_branch_protections | default(omit) }}"
when:
- "git_type == 'github'"
- "api_token is defined"
- name: "Apply repository {{ repo_name }}"
opentelekomcloud.gitcontrol.gitea_org_repository:
token: "{{ api_token }}"
api_url: "{{ api_url }}"
owner: "{{ organization }}"
name: "{{ repo.name | default(repo_name) }}"
state: "{{ repo.state | default('present') }}"
description: "{{ repo.description | default(omit) }}"
allow_manual_merge: "{{ repo.allow_manual_merge | default(omit) }}"
allow_merge_commits: "{{ repo.allow_merge_commits | default(omit) }}"
allow_rebase: "{{ repo.allow_rebase | default(omit) }}"
allow_rebase_explicit: "{{ repo.allow_rebase_explicit | default(omit) }}"
allow_rebase_update: "{{ repo.allow_rebase_update | default(omit) }}"
allow_squash_merge: "{{ repo.allow_squash_merge | default(omit) }}"
auto_init: "{{ repo.auto_init | default(omit) }}"
archived: "{{ repo.archived | default(omit) }}"
autodetect_manual_merge: "{{ repo.autodetect_manual_merge | default(omit) }}"
default_branch: "{{ repo.default_branch | default(omit) }}"
default_delete_branch_after_merge: "{{ repo.default_delete_branch_after_merge | default(omit) }}"
default_merge_style: "{{ repo.default_merge_style | default(omit) }}"
enable_prune: "{{ repo.enable_prune | default(omit) }}"
gitignores: "{{ repo.gitignores | default(omit) }}"
has_issues: "{{ repo.has_issues | default(omit) }}"
has_projects: "{{ repo.has_projects | default(omit) }}"
has_pull_requests: "{{ repo.has_pull_requests | default(omit) }}"
has_wiki: "{{ repo.has_wiki | default(omit) }}"
ignore_whitespace_conflicts: "{{ repo.ignore_whitespace_conflicts | default(omit) }}"
issue_labels: "{{ repo.issue_labels | default(omit) }}"
license: "{{ repo.license | default(omit) }}"
private: "{{ repo.private | default(omit) }}"
readme: "{{ repo.readme | default(omit) }}"
template: "{{ repo.template | default(omit) }}"
trust_model: "{{ repo.trust_model | default(omit) }}"
website: "{{ repo.website | default(omit) }}"
teams: "{{ repo.teams | default(omit) }}"
collaborators: "{{ repo.collaborators | default(omit) }}"
branch_protections: "{{ repo_branch_protections | default(omit) }}"
when:
- "git_type == 'gitea'"
- "api_url is defined"
- "api_token is defined"