Allow force pushes to protected branches

This commit is contained in:
Henry Goodman
2023-11-24 23:55:11 +11:00
committed by Henry Goodman
parent 6c7744370f
commit 50819b0424
11 changed files with 387 additions and 37 deletions
@@ -94,6 +94,69 @@
<p class="help">{{ctx.Locale.Tr "repo.settings.require_signed_commits_desc"}}</p>
</div>
</div>
<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_force_push"}}</h5>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="enable_force_push" value="none" class="toggle-target-disabled" data-target="#force_push_whitelist_box" {{if not .Rule.CanForcePush}}checked{{end}}>
<label>{{ctx.Locale.Tr "repo.settings.protect_disable_force_push"}}</label>
<p class="help">{{ctx.Locale.Tr "repo.settings.protect_disable_force_push_desc"}}</p>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="enable_force_push" value="all" class="toggle-target-disabled" data-target="#force_push_whitelist_box" {{if and (.Rule.CanForcePush) (not .Rule.EnableForcePushWhitelist)}}checked{{end}}>
<label>{{ctx.Locale.Tr "repo.settings.protect_enable_force_push_all"}}</label>
<p class="help">{{ctx.Locale.Tr "repo.settings.protect_enable_force_push_all_desc"}}</p>
</div>
</div>
<div class="grouped fields">
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="enable_force_push" value="whitelist" class="toggle-target-enabled" data-target="#force_push_whitelist_box" {{if and (.Rule.CanForcePush) (.Rule.EnableForcePushWhitelist)}}checked{{end}}>
<label>{{ctx.Locale.Tr "repo.settings.protect_enable_force_push_whitelist"}}</label>
<p class="help">{{ctx.Locale.Tr "repo.settings.protect_enable_force_push_whitelist_desc"}}</p>
</div>
</div>
<div id="force_push_whitelist_box" class="grouped fields {{if not .Rule.EnableForcePushWhitelist}}disabled{{end}}">
<div class="checkbox-sub-item field">
<label>{{ctx.Locale.Tr "repo.settings.protect_force_push_whitelist_users"}}</label>
<div class="ui multiple search selection dropdown">
<input type="hidden" name="force_push_whitelist_users" value="{{.force_push_whitelist_users}}">
<div class="default text">{{ctx.Locale.Tr "repo.settings.protect_whitelist_search_users"}}</div>
<div class="menu">
{{range .Users}}
<div class="item" data-value="{{.ID}}">
{{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}}
</div>
{{end}}
</div>
</div>
</div>
{{if .Owner.IsOrganization}}
<div class="checkbox-sub-item field">
<label>{{ctx.Locale.Tr "repo.settings.protect_force_push_whitelist_teams"}}</label>
<div class="ui multiple search selection dropdown">
<input type="hidden" name="force_push_whitelist_teams" value="{{.force_push_whitelist_teams}}">
<div class="default text">{{ctx.Locale.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
<div class="menu">
{{range .Teams}}
<div class="item" data-value="{{.ID}}">
{{svg "octicon-people"}}
{{.Name}}
</div>
{{end}}
</div>
</div>
</div>
{{end}}
<div class="checkbox-sub-item field">
<div class="ui checkbox">
<input type="checkbox" name="force_push_whitelist_deploy_keys" {{if .Rule.ForcePushWhitelistDeployKeys}}checked{{end}}>
<label>{{ctx.Locale.Tr "repo.settings.protect_force_push_whitelist_deploy_keys"}}</label>
</div>
</div>
</div>
</div>
<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_pull_request_approvals"}}</h5>
<div class="field">
<label>{{ctx.Locale.Tr "repo.settings.protect_required_approvals"}}</label>
+78
View File
@@ -16926,6 +16926,14 @@
"type": "boolean",
"x-go-name": "EnablePushWhitelist"
},
"enable_force_push": {
"type": "boolean",
"x-go-name": "EnableForcePush"
},
"enable_force_push_whitelist": {
"type": "boolean",
"x-go-name": "EnableForcePushWhitelist"
},
"enable_status_check": {
"type": "boolean",
"x-go-name": "EnableStatusCheck"
@@ -16966,6 +16974,24 @@
},
"x-go-name": "PushWhitelistUsernames"
},
"force_push_whitelist_deploy_keys": {
"type": "boolean",
"x-go-name": "ForcePushWhitelistDeployKeys"
},
"force_push_whitelist_teams": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "ForcePushWhitelistTeams"
},
"force_push_whitelist_usernames": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "ForcePushWhitelistUsernames"
},
"require_signed_commits": {
"type": "boolean",
"x-go-name": "RequireSignedCommits"
@@ -17567,6 +17593,14 @@
"type": "boolean",
"x-go-name": "EnablePushWhitelist"
},
"enable_force_push": {
"type": "boolean",
"x-go-name": "EnableForcePush"
},
"enable_force_push_whitelist": {
"type": "boolean",
"x-go-name": "EnableForcePushWhitelist"
},
"enable_status_check": {
"type": "boolean",
"x-go-name": "EnableStatusCheck"
@@ -17607,6 +17641,24 @@
},
"x-go-name": "PushWhitelistUsernames"
},
"force_push_whitelist_deploy_keys": {
"type": "boolean",
"x-go-name": "ForcePushWhitelistDeployKeys"
},
"force_push_whitelist_teams": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "ForcePushWhitelistTeams"
},
"force_push_whitelist_usernames": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "ForcePushWhitelistUsernames"
},
"require_signed_commits": {
"type": "boolean",
"x-go-name": "RequireSignedCommits"
@@ -18699,6 +18751,14 @@
"type": "boolean",
"x-go-name": "EnablePushWhitelist"
},
"enable_force_push": {
"type": "boolean",
"x-go-name": "EnableForcePush"
},
"enable_force_push_whitelist": {
"type": "boolean",
"x-go-name": "EnableForcePushWhitelist"
},
"enable_status_check": {
"type": "boolean",
"x-go-name": "EnableStatusCheck"
@@ -18739,6 +18799,24 @@
},
"x-go-name": "PushWhitelistUsernames"
},
"force_push_whitelist_deploy_keys": {
"type": "boolean",
"x-go-name": "ForcePushWhitelistDeployKeys"
},
"force_push_whitelist_teams": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "ForcePushWhitelistTeams"
},
"force_push_whitelist_usernames": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "ForcePushWhitelistUsernames"
},
"require_signed_commits": {
"type": "boolean",
"x-go-name": "RequireSignedCommits"