Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for status check pattern #24633

Merged
merged 37 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cbc7091
add new field
Zettat123 May 9, 2023
b51490d
add migration
Zettat123 May 10, 2023
99866d4
improve MergeRequiredContextsCommitStatus
Zettat123 May 10, 2023
a1d40c6
format
Zettat123 May 10, 2023
5b7767a
Merge branch 'main' into status-check-pattern
Zettat123 May 10, 2023
e9245b6
update js
Zettat123 May 11, 2023
9facea8
reuse StatusCheckContexts
Zettat123 May 11, 2023
5de7b01
check status with patterns
Zettat123 May 11, 2023
4d2bbed
fix error log
Zettat123 May 11, 2023
ea32840
improve js
Zettat123 May 11, 2023
d4fd091
lint
Zettat123 May 11, 2023
c4bd798
add can_context_match
Zettat123 May 11, 2023
8f73c90
update translation
Zettat123 May 11, 2023
af76f06
replace input with textarea
Zettat123 May 12, 2023
872af3a
improve desc text
Zettat123 May 12, 2023
efa21a1
improve desc text
Zettat123 May 12, 2023
5818403
add desc for patterns textarea
Zettat123 May 12, 2023
f874fec
Merge branch 'main' into status-check-pattern
Zettat123 May 12, 2023
fb9d67d
remove can_context_match
Zettat123 May 12, 2023
1645f25
fix replace and escape
Zettat123 May 12, 2023
087061d
rename
Zettat123 May 12, 2023
11aebb8
fix semicolon
Zettat123 May 12, 2023
25e29b5
disallow empty patterns
Zettat123 May 12, 2023
74958d7
fix locales and escape
Zettat123 May 12, 2023
49746b1
improve MergeRequiredContextsCommitStatus
Zettat123 May 12, 2023
4446237
Merge branch 'main' into status-check-pattern
silverwind May 12, 2023
2f4c1a3
fix comments
Zettat123 May 15, 2023
532f27e
Merge branch 'main' into status-check-pattern
Zettat123 May 15, 2023
2607a4f
Add safeguard
silverwind May 15, 2023
3b42ff6
Update web_src/js/features/repo-settings.js
silverwind May 15, 2023
606394c
use toggleElem
Zettat123 May 15, 2023
2731fdd
Merge branch 'main' into status-check-pattern
Zettat123 May 17, 2023
fe18089
Merge branch 'main' into status-check-pattern
Zettat123 May 17, 2023
8e190b0
fix comments
Zettat123 May 17, 2023
2b82824
fix status check
Zettat123 May 17, 2023
a04c33c
Merge branch 'main' into status-check-pattern
GiteaBot May 17, 2023
541361b
Merge branch 'main' into status-check-pattern
GiteaBot May 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2190,8 +2190,13 @@ settings.protect_merge_whitelist_committers_desc = Allow only whitelisted users
settings.protect_merge_whitelist_users = Whitelisted users for merging:
settings.protect_merge_whitelist_teams = Whitelisted teams for merging:
settings.protect_check_status_contexts = Enable Status Check
settings.protect_check_status_contexts_desc = Require status checks to pass before merging. Choose which status checks must pass before branches can be merged into a branch that matches this rule. When enabled, commits must first be pushed to another branch, then merged or pushed directly to a branch that matches this rule after status checks have passed. If no contexts are selected, the last commit must be successful regardless of context.
settings.protect_status_check_patterns = Status check patterns:
settings.protect_status_check_patterns_desc = Enter patterns to specify which status checks must pass before branches can be merged into a branch that matches this rule. Each line specifies a pattern. Patterns cannot be empty.
settings.protect_check_status_contexts_desc = Require status checks to pass before merging. When enabled, commits must first be pushed to another branch, then merged or pushed directly to a branch that matches this rule after status checks have passed. If no contexts are matched, the last commit must be successful regardless of context.
settings.protect_check_status_contexts_list = Status checks found in the last week for this repository
settings.protect_status_check_matched = Matched
settings.protect_invalid_status_check_pattern = Invalid status check pattern: "%s".
settings.protect_no_valid_status_check_patterns = No valid status check patterns.
settings.protect_required_approvals = Required approvals:
settings.protect_required_approvals_desc = Allow only to merge pull request with enough positive reviews.
settings.protect_approvals_whitelist_enabled = Restrict approvals to whitelisted users or teams
Expand Down
197 changes: 163 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"license-checker-webpack-plugin": "0.2.1",
"mermaid": "10.1.0",
"mini-css-extract-plugin": "2.7.5",
"minimatch": "9.0.0",
silverwind marked this conversation as resolved.
Show resolved Hide resolved
"monaco-editor": "0.38.0",
"monaco-editor-webpack-plugin": "7.0.1",
"pretty-ms": "8.0.0",
Expand Down
6 changes: 5 additions & 1 deletion routers/web/repo/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import (
"code.gitea.io/gitea/services/gitdiff"
pull_service "code.gitea.io/gitea/services/pull"
repo_service "code.gitea.io/gitea/services/repository"

"github.com/gobwas/glob"
)

const (
Expand Down Expand Up @@ -575,7 +577,9 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
if pb != nil && pb.EnableStatusCheck {
ctx.Data["is_context_required"] = func(context string) bool {
for _, c := range pb.StatusCheckContexts {
if c == context {
if gp, err := glob.Compile(c); err != nil {
log.Error("glob.Compile %s failed. Error: %v", c, err)
Zettat123 marked this conversation as resolved.
Show resolved Hide resolved
} else if gp.Match(context) {
return true
}
}
Expand Down
Loading