-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Docs: Split "Automation rules" into reference and how-to (Diátaxis) #9953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
37cf0d6
ed6279d
0c3c136
b4d4922
8205542
c0c3a7f
bf47743
2ca75eb
972eb98
280b837
0671993
0767f59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,87 @@ | ||
Automation Rules | ||
Automation rules | ||
================ | ||
|
||
Automation rules allow project maintainers to automate actions on new branches and tags on repositories. | ||
Automation rules allow project maintainers to automate actions on new branches and tags on Git repositories. | ||
If you are familiar with :term:`GitOps`, | ||
this might seem familiar. | ||
The goal of Read the Docs' automation rules is to be able to control versioning through your Git repository | ||
and avoid duplicating these efforts on Read the Docs. | ||
|
||
Creating an automation rule | ||
--------------------------- | ||
.. seealso:: | ||
|
||
#. Go to your project dashboard | ||
#. Click :guilabel:`Admin` > :guilabel:`Automation Rules` | ||
#. Click on :guilabel:`Add Rule` | ||
#. Fill in the fields | ||
#. Click :guilabel:`Save` | ||
:doc:`/guides/automation-rules` | ||
A practical guide to managing automated versioning of your documentation. | ||
|
||
How do they work? | ||
----------------- | ||
:doc:`/versions` | ||
General explanation of how versioning works for documentation projects on Read the Docs | ||
|
||
How automation rules work | ||
------------------------- | ||
|
||
When a new tag or branch is pushed to your repository, | ||
Read the Docs creates a new version. | ||
Read the Docs receives a callback to its Webhook. | ||
This triggers the creation of a new version. | ||
|
||
All rules are evaluated for this version, in the order they are listed. | ||
If the version matches the version type and the pattern in the rule, | ||
the specified action is performed on that version. | ||
All rules are evaluated for this version, | ||
in the order they are listed. | ||
If the version **matches** the version type and the pattern in the rule, | ||
the specified **action** is performed on that version. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A diagram would be great here in the future, but probably too much for this refactor. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we can establish a quick way to use Mermaid diagrams, this would definitely be a valid option. Last time, I hit some issues that would need to be solved, so ended up generating Mermaid.js and saving as PNG "by hand" which was a bit too cumbersome for a "quick diagram". |
||
|
||
.. note:: | ||
|
||
Versions can match multiple rules, | ||
and all matching actions will be performed on the version. | ||
|
||
Matching a version in Git | ||
------------------------- | ||
|
||
Predefined matches | ||
------------------ | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
Automation rules support several predefined version matches: | ||
Automation rules support two predefined version matches: | ||
|
||
- **Any version**: All new versions will match the rule. | ||
- **SemVer versions**: All new versions that follow `semantic versioning <https://semver.org/>`__ will match the rule. | ||
|
||
User defined matches | ||
-------------------- | ||
~~~~~~~~~~~~~~~~~~~~ | ||
|
||
If none of the above predefined matches meet your use case, | ||
you can use a **Custom match**. | ||
|
||
The custom match should be a valid `Python regular expression <https://docs.python.org/3/library/re.html>`__. | ||
Each new version will be tested against this regular expression. | ||
|
||
Actions | ||
------- | ||
Actions for versions | ||
-------------------- | ||
|
||
When a rule matches a new version, the specified action is performed on that version. | ||
When a rule matches a new version, | ||
the specified action is performed on that version. | ||
Currently, the following actions are available: | ||
|
||
- **Activate version**: Activates and builds the version. | ||
- **Hide version**: Hides the version. If the version is not active, activates it and builds the version. | ||
Activate version | ||
Activates and builds the version. | ||
|
||
Hide version | ||
Hides the version. If the version is not active, activates it and builds the version. | ||
See :ref:`versions:Version States`. | ||
- **Make version public**: Sets the version's privacy level to public. | ||
|
||
Make version public | ||
Sets the version's privacy level to public. | ||
See :ref:`versions:privacy levels`. | ||
- **Make version private**: Sets the version's privacy level to private. | ||
|
||
Make version private | ||
Sets the version's privacy level to private. | ||
See :ref:`versions:privacy levels`. | ||
- **Set version as default**: Sets the version as default, | ||
|
||
Set version as default | ||
Sets the version as default, | ||
i.e. the version of your project that `/` redirects to. | ||
See more in :ref:`automatic-redirects:Root URL`. | ||
It also activates and builds the version. | ||
- **Delete version**: When a branch or tag is deleted from your repository, | ||
|
||
Delete version | ||
When a branch or tag is deleted from your repository, | ||
Read the Docs will delete it *only if isn't active*. | ||
This action allows you to delete *active* versions when a branch or tag is deleted from your repository. | ||
|
||
|
@@ -82,11 +102,8 @@ Currently, the following actions are available: | |
Order | ||
----- | ||
|
||
The order your rules are listed in :guilabel:`Admin` > :guilabel:`Automation Rules` matters. | ||
Each action will be performed in that order, | ||
so first rules have a higher priority. | ||
|
||
You can change the order using the up and down arrow buttons. | ||
When a new webhook event is received from your Git provider, | ||
All rules with a successful match will have their action triggered in the order they appear on the :guilabel:`Automation Rules` page. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need some feedback here. In a former section, we state:
We should be more specific about the trigger. What happens when a new rule is added for a tag or branch and then something new shows up? What happens when a Git tag is deleted and re-added? |
||
|
||
.. note:: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
How to manage versions automatically | ||
==================================== | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This title is great to improve with the user's problem in mind. |
||
|
||
In this guide, | ||
we show you how to define rules to automate creation of new versions on Read the Docs, | ||
using your Git repository's version logic. | ||
Automating your versioning on Read the Docs means you only have to handle your versioning logic in Git. | ||
|
||
.. seealso:: | ||
|
||
:doc:`/versions` | ||
Learn more about versioning of documentation in general. | ||
|
||
:doc:`/automation-rules` | ||
Reference for all different rules and actions possible with automation. | ||
|
||
Adding a new rule | ||
----------------- | ||
|
||
#. Navigate to :menuselection:`Admin --> Automation Rules`. | ||
#. Click on :guilabel:`Add Rule` and you will see the following form. | ||
|
||
.. image:: /img/screenshot_automation_rules_add.png | ||
:alt: Screenshot of the "Add Rule" form | ||
|
||
In the :guilabel:`Automation Rule` form, you need to fill in 4 fields: | ||
|
||
#. Enter a :guilabel:`Description` that you can refer to later. | ||
For example, entering "Create new stable version" is a good title, | ||
as it explains the intention of the rule. | ||
You might have different rules for unstable versions (pre-releases). | ||
|
||
#. Choose a :guilabel:`Match`, | ||
which is the pattern you wish to detect in either a Git branch or tag. | ||
|
||
* :ref:`Any version <automation-rules:Predefined matches>` matches all values. | ||
* :ref:`SemVer versions <automation-rules:Predefined matches>` matches only values that have the `SemVer`_ format. | ||
* :ref:`Custom match <automation-rules:User defined matches>` matches your own pattern (entered below). | ||
If you choose this option, | ||
a field :guilabel:`Custom match` will automatically appear below the drop-down where you can add a regular expression in `Python regex format`_. | ||
|
||
#. Choose a :guilabel:`Version type`. | ||
You can choose between *Tag* or *Branch*, | ||
denoting *Git tag* or *Git branch*. | ||
|
||
#. Finally, choose the :guilabel:`Action`: | ||
|
||
* :ref:`Activate version <automation-rules:Actions for versions>` | ||
* :ref:`Hide version <automation-rules:Actions for versions>` | ||
* :ref:`Set version as default <automation-rules:Actions for versions>` | ||
* :ref:`Delete version (on branch/tag deletion) <automation-rules:Actions for versions>` | ||
|
||
|
||
Now your rule is ready and you can press :guilabel:`Save`. | ||
The rule takes effect immediately when a new version is discovered. | ||
|
||
.. tip:: | ||
|
||
Examples of common usage | ||
See :ref:`the list of examples <automation-rules:Examples>` for rules that are commonly used. | ||
|
||
Want to test if your rule works? | ||
You can test if your rule works in a few minutes without disturbing your readers: | ||
If you are using Git tags in order to create new versions, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't love this, but seems useful. A bit overly specific perhaps, and not always applicable? |
||
create a Git tag that matches the rule and check if your automation action is triggered. | ||
After the experiment, | ||
you can delete the Read the Docs version and the Git tag. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find this tip to be useful, however I don't know if the process is the best way of testing a rule. Are there other ways of checking if a rule triggers? |
||
|
||
|
||
.. _Python regex format: https://docs.python.org/3/library/re.html | ||
.. _SemVer: https://semver.org/ | ||
|
||
Ordering your rules | ||
------------------- | ||
|
||
The order your rules are listed in :menuselection:`Admin --> Automation Rules` matters. | ||
Each action will be performed in that order, | ||
so first rules have a higher priority. | ||
|
||
You can change the order using the up and down arrow buttons. | ||
|
||
.. note:: | ||
|
||
New rules are added at the end (lower priority). |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ Features | |
|
||
analytics | ||
/server-side-search/index | ||
/automation-rules | ||
/badges |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha just read this again and realized that it sounds a lot like "automation rules [verb]"
Maybe that'll make people click it, anyways :)