Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions doc/source/_rulesets/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"id": 2045316,
"name": "Main branch protection",
"target": "branch",
"source_type": "Repository",
"enforcement": "active",
"conditions": {
"ref_name": {
"exclude": [],
"include": [
"~DEFAULT_BRANCH"
]
}
},
"rules": [
{
"type": "deletion"
},
{
"type": "non_fast_forward"
},
{
"type": "branch_name_pattern",
"parameters": {
"operator": "regex",
"pattern": "/release\\/*|feat\\/*|maint\\/*|fix\\/*|junk\\/*|no-ci\\/*|dependabot\\/*|test\\/*|testing\\/*/gm",
"negate": false,
"name": "Branch name must match the regex"
}
},
{
"type": "pull_request",
"parameters": {
"required_approving_review_count": 1,
"dismiss_stale_reviews_on_push": false,
"require_code_owner_review": true,
"require_last_push_approval": false,
"required_review_thread_resolution": true
}
}
],
"bypass_actors": []
}
42 changes: 42 additions & 0 deletions doc/source/_rulesets/tag-create.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"id": 2496378,
"name": "Auto-imported tag create protections",
"target": "tag",
"source_type": "Repository",
"enforcement": "active",
"conditions": {
"ref_name": {
"exclude": [],
"include": [
"refs/tags/v*",
"refs/tags/v*.*",
"refs/tags/v*.*.*"
]
}
},
"rules": [
{
"type": "creation"
},
{
"type": "update"
}
],
"bypass_actors": [
{
"actor_id": 2,
"actor_type": "RepositoryRole",
"bypass_mode": "always"
},
{
"actor_id": 5,
"actor_type": "RepositoryRole",
"bypass_mode": "always"
},
{
"actor_id": 1,
"actor_type": "OrganizationAdmin",
"bypass_mode": "always"
}
]
}
37 changes: 37 additions & 0 deletions doc/source/_rulesets/tag-delete.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"id": 2496375,
"name": "Auto-imported tag delete protections",
"target": "tag",
"source_type": "Repository",
"enforcement": "active",
"conditions": {
"ref_name": {
"exclude": [],
"include": [
"refs/tags/v*",
"refs/tags/v*.*",
"refs/tags/v*.*.*"
]
}
},
"rules": [
{
"type": "update"
},
{
"type": "deletion"
}
],
"bypass_actors": [
{
"actor_id": 5,
"actor_type": "RepositoryRole",
"bypass_mode": "always"
},
{
"actor_id": 1,
"actor_type": "OrganizationAdmin",
"bypass_mode": "always"
}
]
}
24 changes: 22 additions & 2 deletions doc/source/how-to/repository-protection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,32 @@ section:
Once a PR is merged into the ``main`` branch, the PR-related branch is
deleted so that the repository contains only active branches.


Rulesets
--------

Rulesets can be used to protect branches and tags. These can
be imported and exported from Github. The PyAnsys core team provides
template files for the branch protection and tag protection rulesets.

Ruleset files:
:download:`Main branch protection ruleset <../_rulesets/main.json>`
:download:`Tag create <../_rulesets/tag-create.json>`
:download:`Tag delete <../_rulesets/tag-delete.json>`

Please refer to the `Github documentation <https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/managing-rulesets-for-a-repository#importing-a-ruleset>`_
to learn how to import and export rulesets.

.. note::
You still need to manually set the rules for the required status checks
as described below, as they usually are specific to the repository.

Branch protection
-----------------

Branch protection is critical in terms of avoiding malicious code insertion and access
to confidential data. To access the branch protection rulesets for the repository,
select **Settings > Code and automation > Branches**.
select **Settings > Code and automation > Branches**.

Next to **Branch protection rules**, click **Add rule**.

Expand Down Expand Up @@ -74,7 +94,7 @@ For other branches, conventional commits can be enforced by creating a rule
with the following parameters:

- Enforcement status: ``Active``
- Target branches:
- Target branches:
- Include: ``All branches``
- Exclude: ``main``, ``gh-pages``

Expand Down
3 changes: 2 additions & 1 deletion doc/styles/config/vocabularies/ANSYS/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ reStructuredText
REST
RPC
RST
rulesets
[Rr]ulesets
[Rr]uleset
scipy
SEO
[Ss]etuptools
Expand Down
Loading