tea branches list/protect/unprotect #645

Open
leonard.vimond wants to merge 3 commits from leonard.vimond/tea:support_branches into main
First-time contributor

Hello,
This is a proposal to support consulting / protecting / unprotecting branches for a specific repository.
I copied the existing code for "issues" report and adapted to branches. There is no change of legacy code so I do not expect any impact.

Supported commands are "list", "protect", "unprotect":

  • "List" print the list of branches with some available fields from gitea.Branch type.
  • "protect" creates a gitea.BranchProtection with some default parameters for some specific branches
  • "unprotect" destroys gitea.BranchProtection for some specific branches

What is printed now could be enriched with additional information gitea datatypes already offer.

Could you please evaluate this proposal?
I would be happy to receive any comment or remark to take into account.

tea branches unprotect --login opsi --repo opensky main
tea branches list --login opsi --repo opensky --fields name,protected,user-can-merge,user-can-push,protection
[name protected user-can-merge user-can-push protection]
+--------+-----------+----------------+---------------+------------+
| NAME | PROTECTED | USER-CAN-MERGE | USER-CAN-PUSH | PROTECTION |
+--------+-----------+----------------+---------------+------------+
| b_test | false | true | true | |
| main | false | true | true | |
+--------+-----------+----------------+---------------+------------+

tea branches protect --login opsi --repo opensky main
tea branches list --login opsi --repo opensky --fields name,protected,user-can-merge,user-can-push,protection
[name protected user-can-merge user-can-push protection]
+--------+-----------+----------------+---------------+----------------------+
| NAME | PROTECTED | USER-CAN-MERGE | USER-CAN-PUSH | PROTECTION |
+--------+-----------+----------------+---------------+----------------------+
| b_test | false | true | true | |
| main | true | true | false | - enable-push: false |
| | | | | - approving: - |
| | | | | merging: - pushing: |
| | | | | |
+--------+-----------+----------------+---------------+----------------------+

Following commands run OK:

make test
make fmt
make lint

Hello, This is a proposal to support consulting / protecting / unprotecting branches for a specific repository. I copied the existing code for "issues" report and adapted to branches. There is no change of legacy code so I do not expect any impact. Supported commands are "list", "protect", "unprotect": - "List" print the list of branches with some available fields from gitea.Branch type. - "protect" creates a gitea.BranchProtection with some default parameters for some specific branches - "unprotect" destroys gitea.BranchProtection for some specific branches What is printed now could be enriched with additional information gitea datatypes already offer. Could you please evaluate this proposal? I would be happy to receive any comment or remark to take into account. **tea branches unprotect** --login opsi --repo opensky main **tea branches list** --login opsi --repo opensky --fields name,protected,user-can-merge,user-can-push,protection [name protected user-can-merge user-can-push protection] +--------+-----------+----------------+---------------+------------+ | NAME | PROTECTED | USER-CAN-MERGE | USER-CAN-PUSH | PROTECTION | +--------+-----------+----------------+---------------+------------+ | b_test | false | true | true | <None> | | main | false | true | true | <None> | +--------+-----------+----------------+---------------+------------+ **tea branches protect** --login opsi --repo opensky main **tea branches list** --login opsi --repo opensky --fields name,protected,user-can-merge,user-can-push,protection [name protected user-can-merge user-can-push protection] +--------+-----------+----------------+---------------+----------------------+ | NAME | PROTECTED | USER-CAN-MERGE | USER-CAN-PUSH | PROTECTION | +--------+-----------+----------------+---------------+----------------------+ | b_test | false | true | true | <None> | | main | true | true | false | - enable-push: false | | | | | | - approving: - | | | | | | merging: - pushing: | | | | | | | +--------+-----------+----------------+---------------+----------------------+ Following commands run OK: > make test > make fmt > make lint
leonard.vimond added 2 commits 2024-04-16 12:57:44 +00:00
feat: add support of branches, with new commands such as list/protect/unprotect
Signed-off-by: Leonard Vimond <leonard.vimond.e@thalesdigital.io>
3b4ca724f1
fix: complete CLI.md
Signed-off-by: Leonard Vimond <leonard.vimond.e@thalesdigital.io>
Some checks failed
check-and-test / check-and-test (pull_request) Failing after 23s
5f626ecd1d
leonard.vimond added 1 commit 2024-04-17 07:45:55 +00:00
fix: correct CLI.md with output of "make docs"
Signed-off-by: Leonard Vimond <leonard.vimond.e@thalesdigital.io>
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 32s
4550ef60df
leonard.vimond changed title from support_branches to tea branches list/protect/unprotect 2024-04-17 08:32:34 +00:00
leonard.vimond changed title from tea branches list/protect/unprotect to WIP: tea branches list/protect/unprotect 2024-04-17 20:06:50 +00:00
leonard.vimond requested review from lunny 2024-05-02 07:16:45 +00:00
leonard.vimond requested review from jolheiser 2024-05-02 08:07:20 +00:00
Owner

@leonard.vimond Is this ready to be reviewed? If that, we can remove the WIP prefix.

@leonard.vimond Is this ready to be reviewed? If that, we can remove the WIP prefix.
leonard.vimond changed title from WIP: tea branches list/protect/unprotect to tea branches list/protect/unprotect 2024-05-02 15:55:37 +00:00
Author
First-time contributor

yes @lunny, this first contribution is complete and can be reviewed;
some more information related to BranchProtection might be added in the future, but current status is coherent.

yes @lunny, this first contribution is complete and can be reviewed; some more information related to BranchProtection might be added in the future, but current status is coherent.
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 32s
Required
Details
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u support_branches:leonard.vimond-support_branches
git checkout leonard.vimond-support_branches
Sign in to join this conversation.
No description provided.