Skip to content

Commit f61e5bb

Browse files
authored
Merge branch 'main' into support-actions-concurrency
2 parents 49c8f3e + 5bc030e commit f61e5bb

Some content is hidden

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

54 files changed

+623
-210
lines changed

.github/actionlint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ self-hosted-runner:
33
- actuated-4cpu-8gb
44
- actuated-4cpu-16gb
55
- nscloud
6+
- namespace-profile-gitea-release-docker
7+
- namespace-profile-gitea-release-binary

.github/workflows/release-nightly.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ concurrency:
1010

1111
jobs:
1212
nightly-binary:
13-
runs-on: nscloud
13+
runs-on: namespace-profile-gitea-release-binary
1414
steps:
1515
- 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
@@ -58,7 +58,7 @@ jobs:
5858
run: |
5959
aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress
6060
nightly-docker-rootful:
61-
runs-on: ubuntu-latest
61+
runs-on: namespace-profile-gitea-release-docker
6262
steps:
6363
- uses: actions/checkout@v4
6464
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -95,7 +95,7 @@ jobs:
9595
push: true
9696
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
9797
nightly-docker-rootless:
98-
runs-on: ubuntu-latest
98+
runs-on: namespace-profile-gitea-release-docker
9999
steps:
100100
- uses: actions/checkout@v4
101101
# fetch all commits instead of only the last as some branches are long lived and could have many between versions

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ concurrency:
1111

1212
jobs:
1313
binary:
14-
runs-on: nscloud
14+
runs-on: namespace-profile-gitea-release-binary
1515
steps:
1616
- uses: actions/checkout@v4
1717
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -68,7 +68,7 @@ jobs:
6868
env:
6969
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
7070
docker-rootful:
71-
runs-on: ubuntu-latest
71+
runs-on: namespace-profile-gitea-release-docker
7272
steps:
7373
- uses: actions/checkout@v4
7474
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -99,7 +99,7 @@ jobs:
9999
tags: ${{ steps.meta.outputs.tags }}
100100
labels: ${{ steps.meta.outputs.labels }}
101101
docker-rootless:
102-
runs-on: ubuntu-latest
102+
runs-on: namespace-profile-gitea-release-docker
103103
steps:
104104
- uses: actions/checkout@v4
105105
# fetch all commits instead of only the last as some branches are long lived and could have many between versions

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313

1414
jobs:
1515
binary:
16-
runs-on: nscloud
16+
runs-on: namespace-profile-gitea-release-binary
1717
steps:
1818
- uses: actions/checkout@v4
1919
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -70,7 +70,7 @@ jobs:
7070
env:
7171
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
7272
docker-rootful:
73-
runs-on: ubuntu-latest
73+
runs-on: namespace-profile-gitea-release-docker
7474
steps:
7575
- uses: actions/checkout@v4
7676
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -105,7 +105,7 @@ jobs:
105105
tags: ${{ steps.meta.outputs.tags }}
106106
labels: ${{ steps.meta.outputs.labels }}
107107
docker-rootless:
108-
runs-on: ubuntu-latest
108+
runs-on: namespace-profile-gitea-release-docker
109109
steps:
110110
- uses: actions/checkout@v4
111111
# fetch all commits instead of only the last as some branches are long lived and could have many between versions

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ require (
4848
github.com/ethantkoenig/rupture v1.0.1
4949
github.com/felixge/fgprof v0.9.5
5050
github.com/fsnotify/fsnotify v1.7.0
51-
github.com/gliderlabs/ssh v0.3.7
51+
github.com/gliderlabs/ssh v0.3.8
5252
github.com/go-ap/activitypub v0.0.0-20240910141749-b4b8c8aa484c
5353
github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73
5454
github.com/go-chi/chi/v5 v5.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv
293293
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
294294
github.com/git-lfs/pktline v0.0.0-20230103162542-ca444d533ef1 h1:mtDjlmloH7ytdblogrMz1/8Hqua1y8B4ID+bh3rvod0=
295295
github.com/git-lfs/pktline v0.0.0-20230103162542-ca444d533ef1/go.mod h1:fenKRzpXDjNpsIBhuhUzvjCKlDjKam0boRAenTE0Q6A=
296-
github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE=
297-
github.com/gliderlabs/ssh v0.3.7/go.mod h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8=
296+
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
297+
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
298298
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
299299
github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
300300
github.com/go-ap/activitypub v0.0.0-20240910141749-b4b8c8aa484c h1:82lzmsy5Nr6JA6HcLRVxGfbdSoWfW45C6jnY3zFS7Ks=

models/actions/run.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type ActionRun struct {
3636
TriggerUser *user_model.User `xorm:"-"`
3737
ScheduleID int64
3838
Ref string `xorm:"index"` // the commit/tag/… that caused the run
39+
IsRefDeleted bool `xorm:"-"`
3940
CommitSHA string
4041
IsForkPullRequest bool // If this is triggered by a PR from a forked repository or an untrusted user, we need to check if it is approved and limit permissions when running the workflow.
4142
NeedApproval bool // may need approval if it's a fork pull request

models/db/context_committer_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package db // it's not db_test, because this file is for testing the private type halfCommitter
55

66
import (
7-
"fmt"
7+
"errors"
88
"testing"
99

1010
"github.com/stretchr/testify/assert"
@@ -80,7 +80,7 @@ func Test_halfCommitter(t *testing.T) {
8080
testWithCommitter(mockCommitter, func(committer Committer) error {
8181
defer committer.Close()
8282
if true {
83-
return fmt.Errorf("error")
83+
return errors.New("error")
8484
}
8585
return committer.Commit()
8686
})
@@ -94,7 +94,7 @@ func Test_halfCommitter(t *testing.T) {
9494
testWithCommitter(mockCommitter, func(committer Committer) error {
9595
committer.Close()
9696
committer.Commit()
97-
return fmt.Errorf("error")
97+
return errors.New("error")
9898
})
9999

100100
mockCommitter.Assert(t)

models/git/branch.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
repo_model "code.gitea.io/gitea/models/repo"
1313
"code.gitea.io/gitea/models/unit"
1414
user_model "code.gitea.io/gitea/models/user"
15+
"code.gitea.io/gitea/modules/container"
1516
"code.gitea.io/gitea/modules/git"
1617
"code.gitea.io/gitea/modules/log"
1718
"code.gitea.io/gitea/modules/optional"
@@ -169,9 +170,22 @@ func GetBranch(ctx context.Context, repoID int64, branchName string) (*Branch, e
169170
return &branch, nil
170171
}
171172

172-
func GetBranches(ctx context.Context, repoID int64, branchNames []string) ([]*Branch, error) {
173+
func GetBranches(ctx context.Context, repoID int64, branchNames []string, includeDeleted bool) ([]*Branch, error) {
173174
branches := make([]*Branch, 0, len(branchNames))
174-
return branches, db.GetEngine(ctx).Where("repo_id=?", repoID).In("name", branchNames).Find(&branches)
175+
176+
sess := db.GetEngine(ctx).Where("repo_id=?", repoID).In("name", branchNames)
177+
if !includeDeleted {
178+
sess.And("is_deleted=?", false)
179+
}
180+
return branches, sess.Find(&branches)
181+
}
182+
183+
func BranchesToNamesSet(branches []*Branch) container.Set[string] {
184+
names := make(container.Set[string], len(branches))
185+
for _, branch := range branches {
186+
names.Add(branch.Name)
187+
}
188+
return names
175189
}
176190

177191
func AddBranches(ctx context.Context, branches []*Branch) error {

models/issues/issue.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,11 @@ type Issue struct {
125125
IsPull bool `xorm:"INDEX"` // Indicates whether is a pull request or not.
126126
PullRequest *PullRequest `xorm:"-"`
127127
NumComments int
128-
Ref string
129-
PinOrder int `xorm:"DEFAULT 0"`
128+
129+
// TODO: RemoveIssueRef: see "repo/issue/branch_selector_field.tmpl"
130+
Ref string
131+
132+
PinOrder int `xorm:"DEFAULT 0"`
130133

131134
DeadlineUnix timeutil.TimeStamp `xorm:"INDEX"`
132135

0 commit comments

Comments
 (0)