Skip to content

Create branch protection api doesn't honor enable_force_push or enable_force_push_allowlist #33682

Open
@lissom

Description

Description

        data = {
            "rule_name": "master,release/**",
            "enable_force_push": True,
            "enable_force_push_allowlist": True,
            "force_push_allowlist_teams": ["General"],
            "required_approvals": 1,
            "priority": 10,
        }
        url = f"{GITEA_API_URL}/api/v1/repos/{org_name}/{repo_name}/branch_protections"
        response = requests.post(url, headers=HEADERS, data=json.dumps(data))

Looking at the repo in the UI or with a GET call, enable_force_push is completely disabled.

Using the UI, this works.

Gitea Version

1.23.4

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

2.40.1

Operating System

Linux

How are you running Gitea?

Downloaded gitea from the github link.

Database

None

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions