Skip to content

Commit

Permalink
fix: Branch name protection fixes (#531)
Browse files Browse the repository at this point in the history
* fix: Branch name protection fixes

* Apply suggestions from code review

Co-authored-by: Roberto Pastor Muela <[email protected]>

* fix: Add suggested new names

* doc: Add new names to the contributing guide

* Update doc/source/_rulesets/branch_naming.json

Co-authored-by: Roberto Pastor Muela <[email protected]>

---------

Co-authored-by: Roberto Pastor Muela <[email protected]>
  • Loading branch information
AlejandroFernandezLuces and RobPasMue authored Nov 20, 2024
1 parent afa4b63 commit 1722124
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 10 deletions.
37 changes: 37 additions & 0 deletions doc/source/_rulesets/branch_naming.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"id": 2680634,
"name": "Branch naming",
"target": "branch",
"source_type": "Repository",
"enforcement": "active",
"conditions": {
"ref_name": {
"exclude": [
"refs/heads/pre-commit-ci-update-config",
"refs/heads/main",
"refs/heads/gh-pages"
],
"include": [
"~ALL"
]
}
},
"rules": [
{
"type": "deletion"
},
{
"type": "non_fast_forward"
},
{
"type": "branch_name_pattern",
"parameters": {
"operator": "regex",
"pattern": "^(feat|fix|chore|docs|style|refactor|test|testing|perf|ci|no-ci|build|dependabot|release|maint|junk|)\\/.*",
"negate": false,
"name": ""
}
}
],
"bypass_actors": []
}
9 changes: 0 additions & 9 deletions doc/source/_rulesets/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@
{
"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": {
Expand Down
8 changes: 7 additions & 1 deletion doc/source/how-to/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Create a branch
---------------

It is likely that the repository's default branch name is ``main`` or ``master``. This is the
development branch for PyAnsys projects. For more information, see :ref:`Branching model`.
development branch for PyAnsys projects. For more information, see :ref:`Branching model`.

You must implement new contributions in a different branch and then :ref:`Create a pull request`
so that these changes can later be merged into the repository's ``main`` branch.
Expand Down Expand Up @@ -205,6 +205,12 @@ changes any given branch is introducing before looking at the code.
routines.
- ``testing/`` or ``test/``: Improvements or changes to testing.
- ``release/``: Releases (see below).
- ``chore/``: Other changes that don't modify the code.
- ``style/``: Changes that only affect code style.
- ``refactor/``: A code change that neither fixes a bug nor adds a feature.
- ``perf/``: A code change that improves performance.
- ``ci/``: Changes to the CICD configuration files and scripts.
- ``build/``: Changes that affect the build system or external dependencies.

Push your branch
----------------
Expand Down
1 change: 1 addition & 0 deletions doc/source/how-to/repository-protection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ template files for the branch protection and tag protection rulesets.

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

Expand Down

0 comments on commit 1722124

Please sign in to comment.