Skip to content

Commit 147706b

Browse files
authored
Merge branch 'main' into punit/Showing-archive-label-issue-filter
2 parents 64d0d12 + 5e039b0 commit 147706b

File tree

97 files changed

+459
-489
lines changed

Some content is hidden

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

97 files changed

+459
-489
lines changed

.github/workflows/cron-licenses.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
if: github.repository == 'go-gitea/gitea'
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- uses: actions/setup-go@v4
1515
with:
1616
go-version: "~1.21"

.github/workflows/cron-translations.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
if: github.repository == 'go-gitea/gitea'
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: download from crowdin
1515
uses: docker://jonasfranz/crowdin
1616
env:
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ubuntu-latest
3636
if: github.repository == 'go-gitea/gitea'
3737
steps:
38-
- uses: actions/checkout@v3
38+
- uses: actions/checkout@v4
3939
- name: push translations to crowdin
4040
uses: docker://jonasfranz/crowdin
4141
env:

.github/workflows/files-changed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
swagger: ${{ steps.changes.outputs.swagger }}
3535
yaml: ${{ steps.changes.outputs.yaml }}
3636
steps:
37-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
3838
- uses: dorny/paths-filter@v2
3939
id: changes
4040
with:

.github/workflows/pull-compliance.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
needs: files-changed
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
- uses: actions/setup-go@v4
2121
with:
2222
go-version: "~1.21"
@@ -31,7 +31,7 @@ jobs:
3131
needs: files-changed
3232
runs-on: ubuntu-latest
3333
steps:
34-
- uses: actions/checkout@v3
34+
- uses: actions/checkout@v4
3535
- uses: actions/setup-python@v4
3636
with:
3737
python-version: "3.11"
@@ -44,7 +44,7 @@ jobs:
4444
needs: files-changed
4545
runs-on: ubuntu-latest
4646
steps:
47-
- uses: actions/checkout@v3
47+
- uses: actions/checkout@v4
4848
- uses: actions/setup-python@v4
4949
with:
5050
python-version: "3.11"
@@ -57,7 +57,7 @@ jobs:
5757
needs: files-changed
5858
runs-on: ubuntu-latest
5959
steps:
60-
- uses: actions/checkout@v3
60+
- uses: actions/checkout@v4
6161
- uses: actions/setup-node@v3
6262
with:
6363
node-version: 20
@@ -69,7 +69,7 @@ jobs:
6969
needs: files-changed
7070
runs-on: ubuntu-latest
7171
steps:
72-
- uses: actions/checkout@v3
72+
- uses: actions/checkout@v4
7373
- uses: actions/setup-go@v4
7474
with:
7575
go-version: "~1.21"
@@ -86,7 +86,7 @@ jobs:
8686
needs: files-changed
8787
runs-on: ubuntu-latest
8888
steps:
89-
- uses: actions/checkout@v3
89+
- uses: actions/checkout@v4
9090
- uses: actions/setup-go@v4
9191
with:
9292
go-version: "~1.21"
@@ -101,7 +101,7 @@ jobs:
101101
needs: files-changed
102102
runs-on: ubuntu-latest
103103
steps:
104-
- uses: actions/checkout@v3
104+
- uses: actions/checkout@v4
105105
- uses: actions/setup-go@v4
106106
with:
107107
go-version: "~1.21"
@@ -114,7 +114,7 @@ jobs:
114114
needs: files-changed
115115
runs-on: ubuntu-latest
116116
steps:
117-
- uses: actions/checkout@v3
117+
- uses: actions/checkout@v4
118118
- uses: actions/setup-node@v3
119119
with:
120120
node-version: 20
@@ -129,7 +129,7 @@ jobs:
129129
needs: files-changed
130130
runs-on: ubuntu-latest
131131
steps:
132-
- uses: actions/checkout@v3
132+
- uses: actions/checkout@v4
133133
- uses: actions/setup-go@v4
134134
with:
135135
go-version: "~1.21"
@@ -161,7 +161,7 @@ jobs:
161161
needs: files-changed
162162
runs-on: ubuntu-latest
163163
steps:
164-
- uses: actions/checkout@v3
164+
- uses: actions/checkout@v4
165165
- uses: actions/setup-node@v3
166166
with:
167167
node-version: 20
@@ -174,6 +174,6 @@ jobs:
174174
needs: files-changed
175175
runs-on: ubuntu-latest
176176
steps:
177-
- uses: actions/checkout@v3
177+
- uses: actions/checkout@v4
178178
- uses: actions/setup-go@v4
179179
- run: make lint-actions

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
ports:
3939
- "9000:9000"
4040
steps:
41-
- uses: actions/checkout@v3
41+
- uses: actions/checkout@v4
4242
- uses: actions/setup-go@v4
4343
with:
4444
go-version: "~1.21"
@@ -63,7 +63,7 @@ jobs:
6363
needs: files-changed
6464
runs-on: ubuntu-latest
6565
steps:
66-
- uses: actions/checkout@v3
66+
- uses: actions/checkout@v4
6767
- uses: actions/setup-go@v4
6868
with:
6969
go-version: "~1.21"
@@ -128,7 +128,7 @@ jobs:
128128
ports:
129129
- "9000:9000"
130130
steps:
131-
- uses: actions/checkout@v3
131+
- uses: actions/checkout@v4
132132
- uses: actions/setup-go@v4
133133
with:
134134
go-version: "~1.21"
@@ -178,7 +178,7 @@ jobs:
178178
- "587:587"
179179
- "993:993"
180180
steps:
181-
- uses: actions/checkout@v3
181+
- uses: actions/checkout@v4
182182
- uses: actions/setup-go@v4
183183
with:
184184
go-version: "~1.21"
@@ -210,7 +210,7 @@ jobs:
210210
ports:
211211
- "3306:3306"
212212
steps:
213-
- uses: actions/checkout@v3
213+
- uses: actions/checkout@v4
214214
- uses: actions/setup-go@v4
215215
with:
216216
go-version: "~1.21"
@@ -241,7 +241,7 @@ jobs:
241241
ports:
242242
- "1433:1433"
243243
steps:
244-
- uses: actions/checkout@v3
244+
- uses: actions/checkout@v4
245245
- uses: actions/setup-go@v4
246246
with:
247247
go-version: "~1.21"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
needs: files-changed
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
- uses: actions/setup-go@v4
2121
with:
2222
go-version: "~1.21"

.github/workflows/release-nightly.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
nightly-binary:
1313
runs-on: actuated-4cpu-16gb
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
1717
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
1818
- run: git fetch --unshallow --quiet --tags --force
@@ -58,7 +58,7 @@ jobs:
5858
nightly-docker-rootful:
5959
runs-on: actuated-4cpu-16gb
6060
steps:
61-
- uses: actions/checkout@v3
61+
- uses: actions/checkout@v4
6262
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
6363
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
6464
- run: git fetch --unshallow --quiet --tags --force
@@ -95,7 +95,7 @@ jobs:
9595
nightly-docker-rootless:
9696
runs-on: actuated-4cpu-16gb
9797
steps:
98-
- uses: actions/checkout@v3
98+
- uses: actions/checkout@v4
9999
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
100100
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
101101
- run: git fetch --unshallow --quiet --tags --force

models/actions/schedule.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ func init() {
4141
}
4242

4343
// GetSchedulesMapByIDs returns the schedules by given id slice.
44-
func GetSchedulesMapByIDs(ids []int64) (map[int64]*ActionSchedule, error) {
44+
func GetSchedulesMapByIDs(ctx context.Context, ids []int64) (map[int64]*ActionSchedule, error) {
4545
schedules := make(map[int64]*ActionSchedule, len(ids))
46-
return schedules, db.GetEngine(db.DefaultContext).In("id", ids).Find(&schedules)
46+
return schedules, db.GetEngine(ctx).In("id", ids).Find(&schedules)
4747
}
4848

4949
// GetReposMapByIDs returns the repos by given id slice.
50-
func GetReposMapByIDs(ids []int64) (map[int64]*repo_model.Repository, error) {
50+
func GetReposMapByIDs(ctx context.Context, ids []int64) (map[int64]*repo_model.Repository, error) {
5151
repos := make(map[int64]*repo_model.Repository, len(ids))
52-
return repos, db.GetEngine(db.DefaultContext).In("id", ids).Find(&repos)
52+
return repos, db.GetEngine(ctx).In("id", ids).Find(&repos)
5353
}
5454

5555
var cronParser = cron.NewParser(cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor)

models/actions/schedule_spec_list.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ func (specs SpecList) GetScheduleIDs() []int64 {
2323
return ids.Values()
2424
}
2525

26-
func (specs SpecList) LoadSchedules() error {
26+
func (specs SpecList) LoadSchedules(ctx context.Context) error {
2727
scheduleIDs := specs.GetScheduleIDs()
28-
schedules, err := GetSchedulesMapByIDs(scheduleIDs)
28+
schedules, err := GetSchedulesMapByIDs(ctx, scheduleIDs)
2929
if err != nil {
3030
return err
3131
}
@@ -34,7 +34,7 @@ func (specs SpecList) LoadSchedules() error {
3434
}
3535

3636
repoIDs := specs.GetRepoIDs()
37-
repos, err := GetReposMapByIDs(repoIDs)
37+
repos, err := GetReposMapByIDs(ctx, repoIDs)
3838
if err != nil {
3939
return err
4040
}
@@ -95,7 +95,7 @@ func FindSpecs(ctx context.Context, opts FindSpecOptions) (SpecList, int64, erro
9595
return nil, 0, err
9696
}
9797

98-
if err := specs.LoadSchedules(); err != nil {
98+
if err := specs.LoadSchedules(ctx); err != nil {
9999
return nil, 0, err
100100
}
101101
return specs, total, nil

models/admin/task.go

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ type TranslatableMessage struct {
4848
}
4949

5050
// LoadRepo loads repository of the task
51-
func (task *Task) LoadRepo() error {
52-
return task.loadRepo(db.DefaultContext)
53-
}
54-
55-
func (task *Task) loadRepo(ctx context.Context) error {
51+
func (task *Task) LoadRepo(ctx context.Context) error {
5652
if task.Repo != nil {
5753
return nil
5854
}
@@ -70,13 +66,13 @@ func (task *Task) loadRepo(ctx context.Context) error {
7066
}
7167

7268
// LoadDoer loads do user
73-
func (task *Task) LoadDoer() error {
69+
func (task *Task) LoadDoer(ctx context.Context) error {
7470
if task.Doer != nil {
7571
return nil
7672
}
7773

7874
var doer user_model.User
79-
has, err := db.GetEngine(db.DefaultContext).ID(task.DoerID).Get(&doer)
75+
has, err := db.GetEngine(ctx).ID(task.DoerID).Get(&doer)
8076
if err != nil {
8177
return err
8278
} else if !has {
@@ -90,13 +86,13 @@ func (task *Task) LoadDoer() error {
9086
}
9187

9288
// LoadOwner loads owner user
93-
func (task *Task) LoadOwner() error {
89+
func (task *Task) LoadOwner(ctx context.Context) error {
9490
if task.Owner != nil {
9591
return nil
9692
}
9793

9894
var owner user_model.User
99-
has, err := db.GetEngine(db.DefaultContext).ID(task.OwnerID).Get(&owner)
95+
has, err := db.GetEngine(ctx).ID(task.OwnerID).Get(&owner)
10096
if err != nil {
10197
return err
10298
} else if !has {
@@ -110,8 +106,8 @@ func (task *Task) LoadOwner() error {
110106
}
111107

112108
// UpdateCols updates some columns
113-
func (task *Task) UpdateCols(cols ...string) error {
114-
_, err := db.GetEngine(db.DefaultContext).ID(task.ID).Cols(cols...).Update(task)
109+
func (task *Task) UpdateCols(ctx context.Context, cols ...string) error {
110+
_, err := db.GetEngine(ctx).ID(task.ID).Cols(cols...).Update(task)
115111
return err
116112
}
117113

@@ -169,12 +165,12 @@ func (err ErrTaskDoesNotExist) Unwrap() error {
169165
}
170166

171167
// GetMigratingTask returns the migrating task by repo's id
172-
func GetMigratingTask(repoID int64) (*Task, error) {
168+
func GetMigratingTask(ctx context.Context, repoID int64) (*Task, error) {
173169
task := Task{
174170
RepoID: repoID,
175171
Type: structs.TaskTypeMigrateRepo,
176172
}
177-
has, err := db.GetEngine(db.DefaultContext).Get(&task)
173+
has, err := db.GetEngine(ctx).Get(&task)
178174
if err != nil {
179175
return nil, err
180176
} else if !has {
@@ -184,13 +180,13 @@ func GetMigratingTask(repoID int64) (*Task, error) {
184180
}
185181

186182
// GetMigratingTaskByID returns the migrating task by repo's id
187-
func GetMigratingTaskByID(id, doerID int64) (*Task, *migration.MigrateOptions, error) {
183+
func GetMigratingTaskByID(ctx context.Context, id, doerID int64) (*Task, *migration.MigrateOptions, error) {
188184
task := Task{
189185
ID: id,
190186
DoerID: doerID,
191187
Type: structs.TaskTypeMigrateRepo,
192188
}
193-
has, err := db.GetEngine(db.DefaultContext).Get(&task)
189+
has, err := db.GetEngine(ctx).Get(&task)
194190
if err != nil {
195191
return nil, nil, err
196192
} else if !has {
@@ -205,12 +201,12 @@ func GetMigratingTaskByID(id, doerID int64) (*Task, *migration.MigrateOptions, e
205201
}
206202

207203
// CreateTask creates a task on database
208-
func CreateTask(task *Task) error {
209-
return db.Insert(db.DefaultContext, task)
204+
func CreateTask(ctx context.Context, task *Task) error {
205+
return db.Insert(ctx, task)
210206
}
211207

212208
// FinishMigrateTask updates database when migrate task finished
213-
func FinishMigrateTask(task *Task) error {
209+
func FinishMigrateTask(ctx context.Context, task *Task) error {
214210
task.Status = structs.TaskStatusFinished
215211
task.EndTime = timeutil.TimeStampNow()
216212

@@ -231,6 +227,6 @@ func FinishMigrateTask(task *Task) error {
231227
}
232228
task.PayloadContent = string(confBytes)
233229

234-
_, err = db.GetEngine(db.DefaultContext).ID(task.ID).Cols("status", "end_time", "payload_content").Update(task)
230+
_, err = db.GetEngine(ctx).ID(task.ID).Cols("status", "end_time", "payload_content").Update(task)
235231
return err
236232
}

0 commit comments

Comments
 (0)