Trying to add branch restriction to a repository, I was successful in adding a rule, however, I cannot get a group added to the rule.
curl -XPOST --user user:password -H "Content-Type: application/json" -d '{"kind": "push", "pattern": "testing*", "groups": {"name": "testleads"}}' $URL/api/2.0/repositories/team/repo/branch-restrictions
Result:
{"error": {"message": "malformed groups"}}
I have tried different combinations in the groups using full_slug, slug and also changing the inheritance types.
-d '{"kind": "push", "pattern": "testing*", "groups":["name": "devleads"]}'
-d '{"kind": "push", "pattern": "testing*", "groups": {"name": "devleads"}}'
Has anyone tried this?
After a lot of tries, I narrowed it down to this JSON input to be able to add branch restrictions
-d '{"kind": "push", "pattern": "test*", "value": null, "groups": [{"name": "devLeads", "account_privilege": null, "full_slug": "team-name:devleads", "owner": {"username": "team-name", "display_name": "Team Name ", "type": "team"}, "type": "group", "slug": "devleads"}]}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With