Skip to content

Commit 44c2766

Browse files
committed
Merge branch 'main' into git-diff-highlights
2 parents 8bb9de4 + 7cdde20 commit 44c2766

File tree

214 files changed

+2258
-1880
lines changed

Some content is hidden

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

214 files changed

+2258
-1880
lines changed

.github/workflows/pull-compliance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
go-version-file: go.mod
9696
check-latest: true
9797
- run: make deps-backend deps-tools
98-
- run: make lint-go-windows lint-go-vet
98+
- run: make lint-go-windows lint-go-gitea-vet
9999
env:
100100
TAGS: bindata sqlite sqlite_unlock_notify
101101
GOOS: windows

.github/workflows/pull-db-tests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,10 @@ jobs:
202202
test-mssql:
203203
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
204204
needs: files-changed
205-
# specifying the version of ubuntu in use as mssql fails on newer kernels
206-
# pending resolution from vendor
207-
runs-on: ubuntu-20.04
205+
runs-on: ubuntu-latest
208206
services:
209207
mssql:
210-
image: mcr.microsoft.com/mssql/server:2017-latest
208+
image: mcr.microsoft.com/mssql/server:2019-latest
211209
env:
212210
ACCEPT_EULA: Y
213211
MSSQL_PID: Standard

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ EXTRA_GOFLAGS ?=
7373
MAKE_VERSION := $(shell "$(MAKE)" -v | cat | head -n 1)
7474
MAKE_EVIDENCE_DIR := .make_evidence
7575

76+
GOTESTFLAGS ?=
7677
ifeq ($(RACE_ENABLED),true)
7778
GOFLAGS += -race
7879
GOTESTFLAGS += -race
@@ -311,10 +312,10 @@ lint-frontend: lint-js lint-css ## lint frontend files
311312
lint-frontend-fix: lint-js-fix lint-css-fix ## lint frontend files and fix issues
312313

313314
.PHONY: lint-backend
314-
lint-backend: lint-go lint-go-vet lint-go-gopls lint-editorconfig ## lint backend files
315+
lint-backend: lint-go lint-go-gitea-vet lint-go-gopls lint-editorconfig ## lint backend files
315316

316317
.PHONY: lint-backend-fix
317-
lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig ## lint backend files and fix issues
318+
lint-backend-fix: lint-go-fix lint-go-gitea-vet lint-editorconfig ## lint backend files and fix issues
318319

319320
.PHONY: lint-js
320321
lint-js: node_modules ## lint js files
@@ -365,9 +366,9 @@ lint-go-windows:
365366
@GOOS= GOARCH= $(GO) install $(GOLANGCI_LINT_PACKAGE)
366367
golangci-lint run
367368

368-
.PHONY: lint-go-vet
369-
lint-go-vet: ## lint go files with vet
370-
@echo "Running go vet..."
369+
.PHONY: lint-go-gitea-vet
370+
lint-go-gitea-vet: ## lint go files with gitea-vet
371+
@echo "Running gitea-vet..."
371372
@GOOS= GOARCH= $(GO) build code.gitea.io/gitea-vet
372373
@$(GO) vet -vettool=gitea-vet ./...
373374

cmd/hook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ func runHookPostReceive(c *cli.Context) error {
316316
setup(ctx, c.Bool("debug"))
317317

318318
// First of all run update-server-info no matter what
319-
if _, _, err := git.NewCommand(ctx, "update-server-info").RunStdString(nil); err != nil {
319+
if _, _, err := git.NewCommand("update-server-info").RunStdString(ctx, nil); err != nil {
320320
return fmt.Errorf("Failed to call 'git update-server-info': %w", err)
321321
}
322322

custom/conf/app.example.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,9 @@ LEVEL = Info
17671767
;;
17681768
;; convert \r\n to \n for Sendmail
17691769
;SENDMAIL_CONVERT_CRLF = true
1770+
;;
1771+
;; convert links of attached images to inline images. Only for images hosted in this gitea instance.
1772+
;EMBED_ATTACHMENT_IMAGES = false
17701773

17711774
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17721775
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ require (
119119
gitlab.com/gitlab-org/api/client-go v0.123.0
120120
golang.org/x/crypto v0.35.0
121121
golang.org/x/image v0.24.0
122-
golang.org/x/net v0.35.0
122+
golang.org/x/net v0.36.0
123123
golang.org/x/oauth2 v0.27.0
124124
golang.org/x/sync v0.11.0
125125
golang.org/x/sys v0.30.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
867867
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
868868
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
869869
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
870-
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
871-
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
870+
golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA=
871+
golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I=
872872
golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
873873
golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
874874
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

models/actions/runner.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,17 @@ func FixRunnersWithoutBelongingRepo(ctx context.Context) (int64, error) {
337337
}
338338
return res.RowsAffected()
339339
}
340+
341+
func CountWrongRepoLevelRunners(ctx context.Context) (int64, error) {
342+
var result int64
343+
_, err := db.GetEngine(ctx).SQL("SELECT count(`id`) FROM `action_runner` WHERE `repo_id` > 0 AND `owner_id` > 0").Get(&result)
344+
return result, err
345+
}
346+
347+
func UpdateWrongRepoLevelRunners(ctx context.Context) (int64, error) {
348+
result, err := db.GetEngine(ctx).Exec("UPDATE `action_runner` SET `owner_id` = 0 WHERE `repo_id` > 0 AND `owner_id` > 0")
349+
if err != nil {
350+
return 0, err
351+
}
352+
return result.RowsAffected()
353+
}

models/actions/schedule.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,12 @@ func init() {
4343
// GetSchedulesMapByIDs returns the schedules by given id slice.
4444
func GetSchedulesMapByIDs(ctx context.Context, ids []int64) (map[int64]*ActionSchedule, error) {
4545
schedules := make(map[int64]*ActionSchedule, len(ids))
46+
if len(ids) == 0 {
47+
return schedules, nil
48+
}
4649
return schedules, db.GetEngine(ctx).In("id", ids).Find(&schedules)
4750
}
4851

49-
// GetReposMapByIDs returns the repos by given id slice.
50-
func GetReposMapByIDs(ctx context.Context, ids []int64) (map[int64]*repo_model.Repository, error) {
51-
repos := make(map[int64]*repo_model.Repository, len(ids))
52-
return repos, db.GetEngine(ctx).In("id", ids).Find(&repos)
53-
}
54-
5552
// CreateScheduleTask creates new schedule task.
5653
func CreateScheduleTask(ctx context.Context, rows []*ActionSchedule) error {
5754
// Return early if there are no rows to insert

models/actions/schedule_spec_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (specs SpecList) LoadSchedules(ctx context.Context) error {
3232
}
3333

3434
repoIDs := specs.GetRepoIDs()
35-
repos, err := GetReposMapByIDs(ctx, repoIDs)
35+
repos, err := repo_model.GetRepositoriesMapByIDs(ctx, repoIDs)
3636
if err != nil {
3737
return err
3838
}

0 commit comments

Comments
 (0)