Skip to content

Commit f239442

Browse files
committed
Add a project-level configuration for PR builds
This allows users with the feature flag to enable/disable this feature.
1 parent 9e10a03 commit f239442

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

docs/guides/autobuild-docs-for-pull-requests.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ Autobuild Documentation for Pull Requests
22
=========================================
33

44
Read the Docs allows autobuilding documentation for pull/merge requests for GitHub or GitLab projects.
5-
This feature is currently available under a :doc:`Feature Flag </guides/feature-flags>`.
6-
So, you can enable this feature by sending us an `email <mailto:[email protected]>`__ including your project URL.
5+
This feature is currently enabled for a subset of our projects while being rolled out.
6+
You can check to see if your project has it enabled by looking at the :guilabel:`Admin > Advanced settings` and look for :guilabel:`Build pull requests for this project`.
7+
We are rolling this feature out based on the projects age on Read the Docs,
8+
so older projects will get it first.
9+
You can also ask for this feature by sending us an `email <mailto:[email protected]>`__ including your project URL.
710

811
Features
912
--------

readthedocs/projects/forms.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ class Meta:
203203
'analytics_code',
204204
'show_version_warning',
205205
'single_version',
206+
'external_builds_enabled'
206207
)
207208
# These that can be set per-version using a config file.
208209
per_version_settings = (
@@ -259,6 +260,10 @@ def __init__(self, *args, **kwargs):
259260
else:
260261
self.fields['default_version'].widget.attrs['readonly'] = True
261262

263+
# Enable PR builder option on projects w/ feature flag
264+
if not self.instance.has_feature(Feature.EXTERNAL_VERSION_BUILD):
265+
self.fields.pop('external_builds_enabled')
266+
262267
def clean_conf_py_file(self):
263268
filename = self.cleaned_data.get('conf_py_file', '').strip()
264269
if filename and 'conf.py' not in filename:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 2.2.10 on 2020-05-18 20:17
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('projects', '0048_remove_version_privacy_field'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='project',
15+
name='external_builds_enabled',
16+
field=models.BooleanField(default=False, help_text='More information in <a href="https://docs.readthedocs.io/en/latest/guides/autobuild-docs-for-pull-requests.html">our docs</a>', verbose_name='Build pull requests for this project'),
17+
),
18+
]

readthedocs/projects/models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ class Project(models.Model):
202202
),
203203
)
204204

205+
external_builds_enabled = models.BooleanField(
206+
_('Build pull requests for this project'),
207+
default=False,
208+
help_text=_('More information in <a href="https://docs.readthedocs.io/en/latest/guides/autobuild-docs-for-pull-requests.html">our docs</a>') # noqa
209+
)
210+
205211
# Project features
206212
cdn_enabled = models.BooleanField(_('CDN Enabled'), default=False)
207213
analytics_code = models.CharField(

0 commit comments

Comments
 (0)