Skip to content

Commit e441bc6

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (22 commits) [skip ci] Updated translations via Crowdin Fix required contexts and commit status matching bug (go-gitea#34815) Add "Cancel workflow run" button to Actions list page (go-gitea#34817) Use `shallowRef` instead of `ref` in `.vue` files where possible (go-gitea#34813) Edit file workflow for creating a fork and proposing changes (go-gitea#34240) Refactor packages (go-gitea#34777) Refactor wiki (go-gitea#34805) [skip ci] Updated translations via Crowdin Upgrade htmx to 2.0.5 (go-gitea#34809) Forks repository list page follow other repositories page (go-gitea#34784) Add post-installation redirect based on admin account status (go-gitea#34493) Rework delete org and rename org UI (go-gitea#34762) Refactor editor (go-gitea#34780) Improve img lazy loading (go-gitea#34804) [skip ci] Updated translations via Crowdin Fix Feishu webhook signature verification (go-gitea#34788) Upgrade chi to v5.2.2 (go-gitea#34798) Fix the issue of abnormal interface when there is no issue-item on the project page (go-gitea#34791) Fix container range bug (go-gitea#34795) Fix OCI manifest parser (go-gitea#34797) ...
2 parents 441acf6 + 29b2800 commit e441bc6

File tree

211 files changed

+5437
-3135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+5437
-3135
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"version": "lts"
88
},
99
"ghcr.io/devcontainers/features/git-lfs:1.2.2": {},
10-
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
10+
"ghcr.io/devcontainers-extra/features/poetry:2": {},
1111
"ghcr.io/devcontainers/features/python:1": {
1212
"version": "3.12"
1313
},

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ require (
5151
github.com/gliderlabs/ssh v0.3.8
5252
github.com/go-ap/activitypub v0.0.0-20250409143848-7113328b1f3d
5353
github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73
54-
github.com/go-chi/chi/v5 v5.2.1
54+
github.com/go-chi/chi/v5 v5.2.2
5555
github.com/go-chi/cors v1.2.1
5656
github.com/go-co-op/gocron v1.37.0
5757
github.com/go-enry/go-enry/v2 v2.9.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73/go.mod h1:jyveZeGw5La
289289
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 h1:BP4M0CvQ4S3TGls2FvczZtj5Re/2ZzkV9VwqPHH/3Bo=
290290
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
291291
github.com/go-chi/chi/v5 v5.0.1/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
292-
github.com/go-chi/chi/v5 v5.2.1 h1:KOIHODQj58PmL80G2Eak4WdvUzjSJSm0vG72crDCqb8=
293-
github.com/go-chi/chi/v5 v5.2.1/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
292+
github.com/go-chi/chi/v5 v5.2.2 h1:CMwsvRVTbXVytCk1Wd72Zy1LAsAh9GxMmSNWLHCG618=
293+
github.com/go-chi/chi/v5 v5.2.2/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
294294
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
295295
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
296296
github.com/go-co-op/gocron v1.37.0 h1:ZYDJGtQ4OMhTLKOKMIch+/CY70Brbb1dGdooLEhh7b0=

models/actions/run.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,17 @@ func (run *ActionRun) GetPullRequestEventPayload() (*api.PullRequestPayload, err
166166
return nil, fmt.Errorf("event %s is not a pull request event", run.Event)
167167
}
168168

169+
func (run *ActionRun) GetWorkflowRunEventPayload() (*api.WorkflowRunPayload, error) {
170+
if run.Event == webhook_module.HookEventWorkflowRun {
171+
var payload api.WorkflowRunPayload
172+
if err := json.Unmarshal([]byte(run.EventPayload), &payload); err != nil {
173+
return nil, err
174+
}
175+
return &payload, nil
176+
}
177+
return nil, fmt.Errorf("event %s is not a workflow run event", run.Event)
178+
}
179+
169180
func (run *ActionRun) IsSchedule() bool {
170181
return run.ScheduleID > 0
171182
}

models/actions/run_job_list.go

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,31 @@ type FindRunJobOptions struct {
8080
func (opts FindRunJobOptions) ToConds() builder.Cond {
8181
cond := builder.NewCond()
8282
if opts.RunID > 0 {
83-
cond = cond.And(builder.Eq{"run_id": opts.RunID})
83+
cond = cond.And(builder.Eq{"`action_run_job`.run_id": opts.RunID})
8484
}
8585
if opts.RepoID > 0 {
86-
cond = cond.And(builder.Eq{"repo_id": opts.RepoID})
87-
}
88-
if opts.OwnerID > 0 {
89-
cond = cond.And(builder.Eq{"owner_id": opts.OwnerID})
86+
cond = cond.And(builder.Eq{"`action_run_job`.repo_id": opts.RepoID})
9087
}
9188
if opts.CommitSHA != "" {
92-
cond = cond.And(builder.Eq{"commit_sha": opts.CommitSHA})
89+
cond = cond.And(builder.Eq{"`action_run_job`.commit_sha": opts.CommitSHA})
9390
}
9491
if len(opts.Statuses) > 0 {
95-
cond = cond.And(builder.In("status", opts.Statuses))
92+
cond = cond.And(builder.In("`action_run_job`.status", opts.Statuses))
9693
}
9794
if opts.UpdatedBefore > 0 {
98-
cond = cond.And(builder.Lt{"updated": opts.UpdatedBefore})
95+
cond = cond.And(builder.Lt{"`action_run_job`.updated": opts.UpdatedBefore})
9996
}
10097
return cond
10198
}
99+
100+
func (opts FindRunJobOptions) ToJoins() []db.JoinFunc {
101+
if opts.OwnerID > 0 {
102+
return []db.JoinFunc{
103+
func(sess db.Engine) error {
104+
sess.Join("INNER", "repository", "repository.id = repo_id AND repository.owner_id = ?", opts.OwnerID)
105+
return nil
106+
},
107+
}
108+
}
109+
return nil
110+
}

models/actions/run_list.go

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,39 +72,50 @@ type FindRunOptions struct {
7272
TriggerEvent webhook_module.HookEventType
7373
Approved bool // not util.OptionalBool, it works only when it's true
7474
Status []Status
75+
CommitSHA string
7576
}
7677

7778
func (opts FindRunOptions) ToConds() builder.Cond {
7879
cond := builder.NewCond()
7980
if opts.RepoID > 0 {
80-
cond = cond.And(builder.Eq{"repo_id": opts.RepoID})
81-
}
82-
if opts.OwnerID > 0 {
83-
cond = cond.And(builder.Eq{"owner_id": opts.OwnerID})
81+
cond = cond.And(builder.Eq{"`action_run`.repo_id": opts.RepoID})
8482
}
8583
if opts.WorkflowID != "" {
86-
cond = cond.And(builder.Eq{"workflow_id": opts.WorkflowID})
84+
cond = cond.And(builder.Eq{"`action_run`.workflow_id": opts.WorkflowID})
8785
}
8886
if opts.TriggerUserID > 0 {
89-
cond = cond.And(builder.Eq{"trigger_user_id": opts.TriggerUserID})
87+
cond = cond.And(builder.Eq{"`action_run`.trigger_user_id": opts.TriggerUserID})
9088
}
9189
if opts.Approved {
92-
cond = cond.And(builder.Gt{"approved_by": 0})
90+
cond = cond.And(builder.Gt{"`action_run`.approved_by": 0})
9391
}
9492
if len(opts.Status) > 0 {
95-
cond = cond.And(builder.In("status", opts.Status))
93+
cond = cond.And(builder.In("`action_run`.status", opts.Status))
9694
}
9795
if opts.Ref != "" {
98-
cond = cond.And(builder.Eq{"ref": opts.Ref})
96+
cond = cond.And(builder.Eq{"`action_run`.ref": opts.Ref})
9997
}
10098
if opts.TriggerEvent != "" {
101-
cond = cond.And(builder.Eq{"trigger_event": opts.TriggerEvent})
99+
cond = cond.And(builder.Eq{"`action_run`.trigger_event": opts.TriggerEvent})
100+
}
101+
if opts.CommitSHA != "" {
102+
cond = cond.And(builder.Eq{"`action_run`.commit_sha": opts.CommitSHA})
102103
}
103104
return cond
104105
}
105106

107+
func (opts FindRunOptions) ToJoins() []db.JoinFunc {
108+
if opts.OwnerID > 0 {
109+
return []db.JoinFunc{func(sess db.Engine) error {
110+
sess.Join("INNER", "repository", "repository.id = repo_id AND repository.owner_id = ?", opts.OwnerID)
111+
return nil
112+
}}
113+
}
114+
return nil
115+
}
116+
106117
func (opts FindRunOptions) ToOrders() string {
107-
return "`id` DESC"
118+
return "`action_run`.`id` DESC"
108119
}
109120

110121
type StatusInfo struct {

models/fixtures/action_run.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
ref: "refs/heads/master"
1010
commit_sha: "c2d72f548424103f01ee1dc02889c1e2bff816b0"
1111
event: "push"
12+
trigger_event: "push"
1213
is_fork_pull_request: 0
1314
status: 1
1415
started: 1683636528
@@ -28,6 +29,7 @@
2829
ref: "refs/heads/master"
2930
commit_sha: "c2d72f548424103f01ee1dc02889c1e2bff816b0"
3031
event: "push"
32+
trigger_event: "push"
3133
is_fork_pull_request: 0
3234
status: 1
3335
started: 1683636528
@@ -47,6 +49,7 @@
4749
ref: "refs/heads/master"
4850
commit_sha: "c2d72f548424103f01ee1dc02889c1e2bff816b0"
4951
event: "push"
52+
trigger_event: "push"
5053
is_fork_pull_request: 0
5154
status: 6 # running
5255
started: 1683636528
@@ -66,6 +69,47 @@
6669
ref: "refs/heads/test"
6770
commit_sha: "c2d72f548424103f01ee1dc02889c1e2bff816b0"
6871
event: "push"
72+
trigger_event: "push"
73+
is_fork_pull_request: 0
74+
status: 1
75+
started: 1683636528
76+
stopped: 1683636626
77+
created: 1683636108
78+
updated: 1683636626
79+
need_approval: 0
80+
approved_by: 0
81+
-
82+
id: 802
83+
title: "workflow run list"
84+
repo_id: 5
85+
owner_id: 3
86+
workflow_id: "test.yaml"
87+
index: 191
88+
trigger_user_id: 1
89+
ref: "refs/heads/test"
90+
commit_sha: "c2d72f548424103f01ee1dc02889c1e2bff816b0"
91+
event: "push"
92+
trigger_event: "push"
93+
is_fork_pull_request: 0
94+
status: 1
95+
started: 1683636528
96+
stopped: 1683636626
97+
created: 1683636108
98+
updated: 1683636626
99+
need_approval: 0
100+
approved_by: 0
101+
-
102+
id: 803
103+
title: "workflow run list for user"
104+
repo_id: 2
105+
owner_id: 0
106+
workflow_id: "test.yaml"
107+
index: 192
108+
trigger_user_id: 1
109+
ref: "refs/heads/test"
110+
commit_sha: "c2d72f548424103f01ee1dc02889c1e2bff816b0"
111+
event: "push"
112+
trigger_event: "push"
69113
is_fork_pull_request: 0
70114
status: 1
71115
started: 1683636528
@@ -86,6 +130,7 @@
86130
ref: "refs/heads/test"
87131
commit_sha: "c2d72f548424103f01ee1dc02889c1e2bff816b0"
88132
event: "push"
133+
trigger_event: "push"
89134
is_fork_pull_request: 0
90135
status: 2
91136
started: 1683636528

models/fixtures/action_run_job.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,33 @@
9999
status: 2
100100
started: 1683636528
101101
stopped: 1683636626
102+
-
103+
id: 203
104+
run_id: 802
105+
repo_id: 5
106+
owner_id: 0
107+
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
108+
is_fork_pull_request: 0
109+
name: job2
110+
attempt: 1
111+
job_id: job2
112+
needs: '["job1"]'
113+
task_id: 51
114+
status: 5
115+
started: 1683636528
116+
stopped: 1683636626
117+
-
118+
id: 204
119+
run_id: 803
120+
repo_id: 2
121+
owner_id: 0
122+
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
123+
is_fork_pull_request: 0
124+
name: job2
125+
attempt: 1
126+
job_id: job2
127+
needs: '["job1"]'
128+
task_id: 51
129+
status: 5
130+
started: 1683636528
131+
stopped: 1683636626

models/git/lfs.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ type LFSMetaObject struct {
112112
ID int64 `xorm:"pk autoincr"`
113113
lfs.Pointer `xorm:"extends"`
114114
RepositoryID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
115-
Existing bool `xorm:"-"`
116115
CreatedUnix timeutil.TimeStamp `xorm:"created"`
117116
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
118117
}
@@ -146,7 +145,6 @@ func NewLFSMetaObject(ctx context.Context, repoID int64, p lfs.Pointer) (*LFSMet
146145
if err != nil {
147146
return nil, err
148147
} else if exist {
149-
m.Existing = true
150148
return m, committer.Commit()
151149
}
152150

models/repo/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ func (repo *Repository) AllowsPulls(ctx context.Context) bool {
653653

654654
// CanEnableEditor returns true if repository meets the requirements of web editor.
655655
func (repo *Repository) CanEnableEditor() bool {
656-
return !repo.IsMirror
656+
return !repo.IsMirror && !repo.IsArchived
657657
}
658658

659659
// DescriptionHTML does special handles to description and return HTML string.

0 commit comments

Comments
 (0)