Skip to content

Commit ab8bab9

Browse files
Merge branch 'main' into workflow_job_webhook_bp
2 parents 3ccc2eb + 7535af2 commit ab8bab9

File tree

15 files changed

+140
-50
lines changed

15 files changed

+140
-50
lines changed

.github/workflows/release-tag-version.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ jobs:
8888
# 1.2
8989
# 1.2.3
9090
tags: |
91+
type=semver,pattern={{version}}
9192
type=semver,pattern={{major}}
9293
type=semver,pattern={{major}}.{{minor}}
93-
type=semver,pattern={{version}}
9494
- name: Login to Docker Hub
9595
uses: docker/login-action@v3
9696
with:
@@ -126,9 +126,9 @@ jobs:
126126
# 1.2
127127
# 1.2.3
128128
tags: |
129+
type=semver,pattern={{version}}
129130
type=semver,pattern={{major}}
130131
type=semver,pattern={{major}}.{{minor}}
131-
type=semver,pattern={{version}}
132132
- name: Login to Docker Hub
133133
uses: docker/login-action@v3
134134
with:

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ require (
117117
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
118118
github.com/yuin/goldmark-meta v1.1.0
119119
gitlab.com/gitlab-org/api/client-go v0.123.0
120-
golang.org/x/crypto v0.33.0
120+
golang.org/x/crypto v0.35.0
121121
golang.org/x/image v0.24.0
122122
golang.org/x/net v0.35.0
123-
golang.org/x/oauth2 v0.26.0
123+
golang.org/x/oauth2 v0.27.0
124124
golang.org/x/sync v0.11.0
125125
golang.org/x/sys v0.30.0
126126
golang.org/x/text v0.22.0

go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,9 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
831831
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
832832
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
833833
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
834-
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
835834
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
835+
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
836+
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
836837
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa h1:t2QcU6V556bFjYgu4L6C+6VrCPyJZ+eyRsABUPs1mz4=
837838
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk=
838839
golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ=
@@ -868,8 +869,8 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
868869
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
869870
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
870871
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
871-
golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE=
872-
golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
872+
golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
873+
golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
873874
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
874875
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
875876
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

models/activities/action.go

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,24 @@ func ActivityReadable(user, doer *user_model.User) bool {
454454
doer != nil && (doer.IsAdmin || user.ID == doer.ID)
455455
}
456456

457+
func FeedDateCond(opts GetFeedsOptions) builder.Cond {
458+
cond := builder.NewCond()
459+
if opts.Date == "" {
460+
return cond
461+
}
462+
463+
dateLow, err := time.ParseInLocation("2006-01-02", opts.Date, setting.DefaultUILocation)
464+
if err != nil {
465+
log.Warn("Unable to parse %s, filter not applied: %v", opts.Date, err)
466+
} else {
467+
dateHigh := dateLow.Add(86399000000000) // 23h59m59s
468+
469+
cond = cond.And(builder.Gte{"`action`.created_unix": dateLow.Unix()})
470+
cond = cond.And(builder.Lte{"`action`.created_unix": dateHigh.Unix()})
471+
}
472+
return cond
473+
}
474+
457475
func ActivityQueryCondition(ctx context.Context, opts GetFeedsOptions) (builder.Cond, error) {
458476
cond := builder.NewCond()
459477

@@ -534,17 +552,7 @@ func ActivityQueryCondition(ctx context.Context, opts GetFeedsOptions) (builder.
534552
cond = cond.And(builder.Eq{"is_deleted": false})
535553
}
536554

537-
if opts.Date != "" {
538-
dateLow, err := time.ParseInLocation("2006-01-02", opts.Date, setting.DefaultUILocation)
539-
if err != nil {
540-
log.Warn("Unable to parse %s, filter not applied: %v", opts.Date, err)
541-
} else {
542-
dateHigh := dateLow.Add(86399000000000) // 23h59m59s
543-
544-
cond = cond.And(builder.Gte{"`action`.created_unix": dateLow.Unix()})
545-
cond = cond.And(builder.Lte{"`action`.created_unix": dateHigh.Unix()})
546-
}
547-
}
555+
cond = cond.And(FeedDateCond(opts))
548556

549557
return cond, nil
550558
}

models/activities/action_list.go

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,31 @@ func GetFeeds(ctx context.Context, opts GetFeedsOptions) (ActionList, int64, err
208208
return nil, 0, fmt.Errorf("need at least one of these filters: RequestedUser, RequestedTeam, RequestedRepo")
209209
}
210210

211-
cond, err := ActivityQueryCondition(ctx, opts)
212-
if err != nil {
213-
return nil, 0, err
211+
var err error
212+
var cond builder.Cond
213+
// if the actor is the requested user or is an administrator, we can skip the ActivityQueryCondition
214+
if opts.Actor != nil && opts.RequestedUser != nil && (opts.Actor.IsAdmin || opts.Actor.ID == opts.RequestedUser.ID) {
215+
cond = builder.Eq{
216+
"user_id": opts.RequestedUser.ID,
217+
}.And(
218+
FeedDateCond(opts),
219+
)
220+
221+
if !opts.IncludeDeleted {
222+
cond = cond.And(builder.Eq{"is_deleted": false})
223+
}
224+
225+
if !opts.IncludePrivate {
226+
cond = cond.And(builder.Eq{"is_private": false})
227+
}
228+
if opts.OnlyPerformedBy {
229+
cond = cond.And(builder.Eq{"act_user_id": opts.RequestedUser.ID})
230+
}
231+
} else {
232+
cond, err = ActivityQueryCondition(ctx, opts)
233+
if err != nil {
234+
return nil, 0, err
235+
}
214236
}
215237

216238
actions := make([]*Action, 0, opts.PageSize)

options/locale/locale_en-US.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,8 @@ issues.filter_milestones = Filter Milestone
14651465
issues.filter_projects = Filter Project
14661466
issues.filter_labels = Filter Label
14671467
issues.filter_reviewers = Filter Reviewer
1468+
issues.filter_no_results = No results
1469+
issues.filter_no_results_placeholder = Try adjusting your search filters.
14681470
issues.new = New Issue
14691471
issues.new.title_empty = Title cannot be empty
14701472
issues.new.labels = Labels

routers/web/devtest/mock_actions.go

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,22 @@ func generateMockStepsLog(logCur actions.LogCursor) (stepsLog []*actions.ViewSte
5252
return stepsLog
5353
}
5454

55+
func MockActionsView(ctx *context.Context) {
56+
ctx.Data["RunID"] = ctx.PathParam("run")
57+
ctx.Data["JobID"] = ctx.PathParam("job")
58+
ctx.HTML(http.StatusOK, "devtest/repo-action-view")
59+
}
60+
5561
func MockActionsRunsJobs(ctx *context.Context) {
56-
req := web.GetForm(ctx).(*actions.ViewRequest)
62+
runID := ctx.PathParamInt64("run")
5763

64+
req := web.GetForm(ctx).(*actions.ViewRequest)
5865
resp := &actions.ViewResponse{}
5966
resp.State.Run.TitleHTML = `mock run title <a href="/">link</a>`
6067
resp.State.Run.Status = actions_model.StatusRunning.String()
61-
resp.State.Run.CanCancel = true
68+
resp.State.Run.CanCancel = runID == 10
69+
resp.State.Run.CanApprove = runID == 20
70+
resp.State.Run.CanRerun = runID == 30
6271
resp.State.Run.CanDeleteArtifact = true
6372
resp.State.Run.WorkflowID = "workflow-id"
6473
resp.State.Run.WorkflowLink = "./workflow-link"
@@ -85,6 +94,29 @@ func MockActionsRunsJobs(ctx *context.Context) {
8594
Size: 1024 * 1024,
8695
Status: "completed",
8796
})
97+
98+
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &actions.ViewJob{
99+
ID: runID * 10,
100+
Name: "job 100",
101+
Status: actions_model.StatusRunning.String(),
102+
CanRerun: true,
103+
Duration: "1h",
104+
})
105+
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &actions.ViewJob{
106+
ID: runID*10 + 1,
107+
Name: "job 101",
108+
Status: actions_model.StatusWaiting.String(),
109+
CanRerun: false,
110+
Duration: "2h",
111+
})
112+
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &actions.ViewJob{
113+
ID: runID*10 + 2,
114+
Name: "job 102",
115+
Status: actions_model.StatusFailure.String(),
116+
CanRerun: false,
117+
Duration: "3h",
118+
})
119+
88120
resp.State.CurrentJob.Steps = append(resp.State.CurrentJob.Steps, &actions.ViewJobStep{
89121
Summary: "step 0 (mock slow)",
90122
Duration: time.Hour.String(),

routers/web/repo/githttp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func httpBase(ctx *context.Context) *serviceHandler {
7878
strings.HasSuffix(ctx.Req.URL.Path, "git-upload-archive") {
7979
isPull = true
8080
} else {
81-
isPull = ctx.Req.Method == "GET"
81+
isPull = ctx.Req.Method == "HEAD" || ctx.Req.Method == "GET"
8282
}
8383

8484
var accessMode perm.AccessMode

routers/web/web.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,7 @@ func registerRoutes(m *web.Router) {
16341634
m.Any("", devtest.List)
16351635
m.Any("/fetch-action-test", devtest.FetchActionTest)
16361636
m.Any("/{sub}", devtest.Tmpl)
1637+
m.Get("/repo-action-view/{run}/{job}", devtest.MockActionsView)
16371638
m.Post("/actions-mock/runs/{run}/jobs/{job}", web.Bind(actions.ViewRequest{}), devtest.MockActionsRunsJobs)
16381639
})
16391640
}

services/context/api.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,11 @@ func RepoRefForAPI(next http.Handler) http.Handler {
291291
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
292292
ctx := GetAPIContext(req)
293293

294+
if ctx.Repo.Repository.IsEmpty {
295+
ctx.APIErrorNotFound("repository is empty")
296+
return
297+
}
298+
294299
if ctx.Repo.GitRepo == nil {
295300
ctx.APIErrorInternal(fmt.Errorf("no open git repo"))
296301
return

0 commit comments

Comments
 (0)