File tree Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Read the Docs PR preview
2
+ # Automatically edits a pull request's descriptions with a link
3
+ # to the documentation's preview on Read the Docs.
4
+
5
+ on :
6
+ pull_request_target :
7
+ types :
8
+ - opened
9
+ paths :
10
+ - ' Doc/**'
11
+ - ' .github/workflows/doc.yml'
12
+
13
+ permissions :
14
+ pull-requests : write
15
+
16
+ concurrency :
17
+ group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
18
+ cancel-in-progress : true
19
+
20
+ jobs :
21
+ documentation-links :
22
+ runs-on : ubuntu-latest
23
+ steps :
24
+ - uses : readthedocs/actions/preview@v1
25
+ with :
26
+ project-slug : " cpython-previews"
27
+ single-version : " true"
Original file line number Diff line number Diff line change
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+ # Project page: https://readthedocs.org/projects/cpython-previews/
4
+
5
+ version : 2
6
+
7
+ sphinx :
8
+ configuration : Doc/conf.py
9
+
10
+ build :
11
+ os : ubuntu-22.04
12
+ tools :
13
+ python : " 3"
14
+
15
+ commands :
16
+ - make -C Doc venv html
17
+ - mkdir _readthedocs
18
+ - mv Doc/build/html _readthedocs/html
Original file line number Diff line number Diff line change 109
109
# Short title used e.g. for <title> HTML tags.
110
110
html_short_title = '%s Documentation' % release
111
111
112
+ # Deployment preview information
113
+ # (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
114
+ repository_url = os .getenv ("READTHEDOCS_GIT_CLONE_URL" )
115
+ html_context = {
116
+ "is_deployment_preview" : os .getenv ("READTHEDOCS_VERSION_TYPE" ) == "external" ,
117
+ "repository_url" : repository_url .removesuffix (".git" ) if repository_url else None ,
118
+ "pr_id" : os .getenv ("READTHEDOCS_VERSION" )
119
+ }
120
+
112
121
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
113
122
# using the given strftime format.
114
123
html_last_updated_fmt = '%b %d, %Y'
Original file line number Diff line number Diff line change 8
8
< a href ="/3/{{ pagename }}{{ file_suffix }} "> {% trans %} Python documentation for the current stable release{% endtrans %}</ a > .
9
9
</ div >
10
10
{%- endif %}
11
+
12
+ {%- if is_deployment_preview %}
13
+ < div id ="deployment-preview-warning " style ="padding: .5em; text-align: center; background-color: #fff2ba; color: #6a580e; ">
14
+ {% trans %}This is a deploy preview created from a < a href ="{{ repository_url }}/pull/{{ pr_id }} "> pull request</ a > .
15
+ For authoritative documentation, see the {% endtrans %}
16
+ < a href ="https://docs.python.org/3/{{ pagename }}{{ file_suffix }} "> {% trans %} the current stable release{% endtrans %}</ a > .
17
+ </ div >
18
+ {%- endif %}
11
19
{% endblock %}
12
20
13
21
{% block rootrellink %}
You can’t perform that action at this time.
0 commit comments