-
Notifications
You must be signed in to change notification settings - Fork 2
/
copier.yml
187 lines (160 loc) · 5.82 KB
/
copier.yml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
---
# Subdirectory that contains the template. Allows template metadata to be separated from the template.
_subdirectory: project_template
# Require that the user has the specified Copier version installed.
_min_copier_version: "9.1.0"
# Tasks that are run after project is generated/updated
_tasks:
- >-
{%- if is_gh_actions -%}
cp {{ _copier_conf.src_path }}/.github/workflows/rename-project.yml {{ _copier_conf.dst_path }}/.github/workflows/rename-project.yml
{% endif %}
- >-
SET_UP_GIT_REPO="{{ set_up_git_repo }}"
PACKAGE_MANAGER="{{ package_manager }}"
REPO_OWNER="{{ repository_owner }}"
REPO_NAME="{{ repository_name }}"
REPO_DESCRIPTION="{{ repository_description }}"
REPO_VISIBILITY="{{ repository_visibility }}"
DEFAULT_BRANCH="{{ default_branch }}"
DISMISS_STALE_REVIEWS="{{ dismiss_stale_reviews | lower }}"
REQUIRED_APPROVING_REVIEW_COUNT="{{ required_approving_review_count }}"
REQUIRE_LAST_PUSH_APPROVAL="{{ require_last_push_approval | lower }}"
REQUIRE_CONVERSATION_RESOLUTION="{{ require_conversation_resolution | lower }}"
./copier_scripts/run_tasks.sh
# Questions to ask the user
_message_before_copy: |
You'll be asked a series of questions whose answers will be used to generate a tailored project for you.
repository_name:
type: str
help: What is your repository name? (e.g. my-awesome-project)
validator: >-
{% if not repository_name %}
The repository name is required.
{% endif %}
{% if not repository_name | regex_search('^[a-zA-Z0-9._-]{1,100}$') %}
The repository name is not valid. It must be 1-100 characters long and contain only letters, numbers, periods, hyphens, and underscores.
{% endif %}
repository_description:
type: str
help: "What is your repository description?"
validator: >-
{% if not repository_description %}
The repository description is required.
{% endif %}
repository_owner:
type: str
help: "What is your repository owner? (e.g. your GitHub username)"
default: "ONSdigital"
repository_visibility:
type: str
help: "What is your repository visibility?"
default: "public"
choices:
- public
- internal
- private
repository_slug:
type: str
help: "Not prompted. This is computed for re-use."
default: "{{ repository_name | lower | replace('-', '_') | replace(' ', '_') }}"
when: false
is_public_repo:
type: bool
help: "Not prompted. This is computed for re-use."
default: "{{ repository_visibility == 'public' }}"
when: false
module_name:
type: str
help: "What is your Python module name? (e.g. app/src/{{ repository_slug }})"
default: "{{ repository_slug }}"
validator: >-
{% if not (module_name | regex_search('^[a-z][a-z0-9\_\-]+$')) %}
Must use a lowercase letter followed by one or more of (a-z, 0-9, _, -).
{% endif %}
enable_dependabot_version_updates:
type: bool
help: "Do you want to enable Dependabot version updates? (Default is Yes - Note: Security updates are always enabled)"
default: true
dependabot_open_pull_requests_limit:
type: int
help: "Maximum number of open pull requests at once for Dependabot version updates"
default: 10
when: "{{ enable_dependabot_version_updates }}"
package_manager:
type: str
help: "What Python package manager do you want to use?"
default: "poetry"
choices:
- poetry
- pipenv
set_up_git_repo:
type: bool
help: "Do you want to set up the git repository? (Create/Push/Configure the repo in GitHub) (Default is Yes)"
default: "{{ not is_gh_actions }}"
when: "{{ not is_gh_actions }}"
default_branch:
type: str
help: "What is your default branch name?"
default: "main"
repo_settings:
type: str
help: "Would you like to customise your repository settings or apply recommended settings? (Default is recommended)"
default: "recommended"
choices:
- recommended
- custom
when: "{{ set_up_git_repo }}"
dismiss_stale_reviews:
type: bool
help: "Dismiss stale pull request approvals when new commits are pushed? (Default is Yes)"
default: true
when: "{{ repo_settings == 'custom' }}"
required_approving_review_count:
type: int
help: "Number of approving reviews required to merge a pull request (Default is 1)"
default: 1
when: "{{ repo_settings == 'custom' }}"
require_last_push_approval:
type: bool
help: "Require approval of the most recent reviewable push?. (Default is Yes)"
default: true
when: "{{ repo_settings == 'custom' }}"
require_conversation_resolution:
type: bool
help: "Require conversation resolution before merging?. (Default is Yes)"
default: true
when: "{{ repo_settings == 'custom' }}"
# :TODO: Currently updates are not supported until Copier changes how tasks work: https://github.com/copier-org/copier/issues/240:
# Tasks currently execute twice on updates, which causes issues with the current setup
enable_copier_updates:
type: bool
help: "Do you want to enable on demand Copier updates? (Pull in changes from the template) (Default is Yes)"
default: false
when: false
# Vars for convenience, these are not prompted but computed for ease of use
is_gh_actions:
type: bool
help: "Not prompted. This is computed for re-use."
default: false
when: false
poetry_copier:
type: bool
help: "Not prompted. This is computed for re-use."
default: "{{ package_manager == 'poetry' and enable_copier_updates }}"
when: false
not_poetry_copier:
type: bool
help: "Not prompted. This is computed for re-use."
default: "{{ package_manager == 'poetry' and not enable_copier_updates }}"
when: false
pipenv_copier:
type: bool
help: "Not prompted. This is computed for re-use."
default: "{{ package_manager == 'pipenv' and enable_copier_updates }}"
when: false
not_pipenv_copier:
type: bool
help: "Not prompted. This is computed for re-use."
default: "{{ package_manager == 'pipenv' and not enable_copier_updates }}"
when: false