From c314d71b3c15604927714c8e4232d834c0451359 Mon Sep 17 00:00:00 2001 From: afernand Date: Wed, 20 Nov 2024 09:38:20 +0100 Subject: [PATCH 1/5] fix: Branch name protection fixes --- doc/source/_rulesets/branch_naming.json | 33 +++++++++++++++++++++ doc/source/_rulesets/main.json | 9 ------ doc/source/how-to/repository-protection.rst | 1 + 3 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 doc/source/_rulesets/branch_naming.json diff --git a/doc/source/_rulesets/branch_naming.json b/doc/source/_rulesets/branch_naming.json new file mode 100644 index 00000000..312f39ea --- /dev/null +++ b/doc/source/_rulesets/branch_naming.json @@ -0,0 +1,33 @@ +{ + "id": 2680634, + "name": "Branch naming", + "target": "branch", + "source_type": "Repository", + "enforcement": "active", + "conditions": { + "ref_name": { + "exclude": [], + "include": [ + "~ALL" + ] + } + }, + "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\\/*|docs\\/*", + "negate": false, + "name": "" + } + } + ], + "bypass_actors": [] +} \ No newline at end of file diff --git a/doc/source/_rulesets/main.json b/doc/source/_rulesets/main.json index c2031bd9..f9f0cdd4 100644 --- a/doc/source/_rulesets/main.json +++ b/doc/source/_rulesets/main.json @@ -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": { diff --git a/doc/source/how-to/repository-protection.rst b/doc/source/how-to/repository-protection.rst index 3d1b5be9..415e692d 100644 --- a/doc/source/how-to/repository-protection.rst +++ b/doc/source/how-to/repository-protection.rst @@ -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>` From 25d26203e5d95b9d8889189bdc2c3c539c7d512f Mon Sep 17 00:00:00 2001 From: Alex Fernandez <21alex295@gmail.com> Date: Wed, 20 Nov 2024 10:04:11 +0100 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- doc/source/_rulesets/branch_naming.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/source/_rulesets/branch_naming.json b/doc/source/_rulesets/branch_naming.json index 312f39ea..def4a2a4 100644 --- a/doc/source/_rulesets/branch_naming.json +++ b/doc/source/_rulesets/branch_naming.json @@ -6,7 +6,11 @@ "enforcement": "active", "conditions": { "ref_name": { - "exclude": [], + "exclude": [ + "refs/heads/pre-commit-ci-update-config", + "refs/heads/main", + "refs/heads/gh-pages" + ], "include": [ "~ALL" ] @@ -23,7 +27,7 @@ "type": "branch_name_pattern", "parameters": { "operator": "regex", - "pattern": "release\\/*|feat\\/*|maint\\/*|fix\\/*|junk\\/*|no-ci\\/*|dependabot\\/*|test\\/*|testing\\/*|docs\\/*", + "pattern": "^(feat|fix|chore|docs|style|refactor|test|testing|perf|ci|no-ci|build|dependabot|release|maint|junk|)\\/.*", "negate": false, "name": "" } From 1a3cac1191d73e531067234d85462e9f55d57751 Mon Sep 17 00:00:00 2001 From: afernand Date: Wed, 20 Nov 2024 10:07:50 +0100 Subject: [PATCH 3/5] fix: Add suggested new names --- doc/source/_rulesets/branch_naming.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/_rulesets/branch_naming.json b/doc/source/_rulesets/branch_naming.json index def4a2a4..a594a140 100644 --- a/doc/source/_rulesets/branch_naming.json +++ b/doc/source/_rulesets/branch_naming.json @@ -27,7 +27,7 @@ "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|)\\/.*", + "pattern": "^(feat|fix|chore|docs|style|refactor|test|testing|perf|ci|no-ci|build|dependabot|release|maint|junk|chore|style|refactor|perf|ci|build)\\/.*", "negate": false, "name": "" } From 703438db3f4acabb19b508359fe2036aa9384faa Mon Sep 17 00:00:00 2001 From: afernand Date: Wed, 20 Nov 2024 10:13:44 +0100 Subject: [PATCH 4/5] doc: Add new names to the contributing guide --- doc/source/how-to/contributing.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/source/how-to/contributing.rst b/doc/source/how-to/contributing.rst index e73fb9c8..8079a174 100644 --- a/doc/source/how-to/contributing.rst +++ b/doc/source/how-to/contributing.rst @@ -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. @@ -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 ---------------- From 99b7cbce8f1510ec821d2080a44a6853c7d692f5 Mon Sep 17 00:00:00 2001 From: Alex Fernandez <21alex295@gmail.com> Date: Wed, 20 Nov 2024 10:17:15 +0100 Subject: [PATCH 5/5] Update doc/source/_rulesets/branch_naming.json Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- doc/source/_rulesets/branch_naming.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/_rulesets/branch_naming.json b/doc/source/_rulesets/branch_naming.json index a594a140..def4a2a4 100644 --- a/doc/source/_rulesets/branch_naming.json +++ b/doc/source/_rulesets/branch_naming.json @@ -27,7 +27,7 @@ "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|chore|style|refactor|perf|ci|build)\\/.*", + "pattern": "^(feat|fix|chore|docs|style|refactor|test|testing|perf|ci|no-ci|build|dependabot|release|maint|junk|)\\/.*", "negate": false, "name": "" }