Skip to content

Commit 0823573

Browse files
committed
Merge branch 'main' of https://github.com/go-gitea/gitea into ephemeral-runners
2 parents cbea9db + 2c8bdd2 commit 0823573

File tree

102 files changed

+956
-838
lines changed

Some content is hidden

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

102 files changed

+956
-838
lines changed

.eslintrc.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ module.exports = {
336336
'@typescript-eslint/no-unsafe-unary-minus': [2],
337337
'@typescript-eslint/no-unused-expressions': [0],
338338
'@typescript-eslint/no-unused-vars': [2, {vars: 'all', args: 'all', caughtErrors: 'all', ignoreRestSiblings: false, argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_'}],
339-
'@typescript-eslint/no-use-before-define': [0],
339+
'@typescript-eslint/no-use-before-define': [2, {functions: false, classes: true, variables: true, allowNamedExports: true, typedefs: false, enums: false, ignoreTypeReferences: true}],
340340
'@typescript-eslint/no-useless-constructor': [0],
341341
'@typescript-eslint/no-useless-empty-export': [0],
342342
'@typescript-eslint/no-wrapper-object-types': [2],
@@ -693,7 +693,7 @@ module.exports = {
693693
'no-unused-labels': [2],
694694
'no-unused-private-class-members': [2],
695695
'no-unused-vars': [0], // handled by @typescript-eslint/no-unused-vars
696-
'no-use-before-define': [2, {functions: false, classes: true, variables: true, allowNamedExports: true}],
696+
'no-use-before-define': [0], // handled by @typescript-eslint/no-use-before-define
697697
'no-use-extend-native/no-use-extend-native': [2],
698698
'no-useless-backreference': [2],
699699
'no-useless-call': [2],

.github/labeler.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ modifies/internal:
4141
- ".dockerignore"
4242
- "docker/**"
4343
- ".editorconfig"
44-
- ".eslintrc.yaml"
44+
- ".eslintrc.cjs"
4545
- ".golangci.yml"
4646
- ".gitpod.yml"
4747
- ".markdownlint.yaml"
4848
- ".spectral.yaml"
4949
- "stylelint.config.js"
5050
- ".yamllint.yaml"
5151
- ".github/**"
52-
- ".gitea/"
52+
- ".gitea/**"
5353
- ".devcontainer/**"
5454
- "build.go"
5555
- "build/**"
@@ -73,9 +73,9 @@ modifies/go:
7373
modifies/frontend:
7474
- changed-files:
7575
- any-glob-to-any-file:
76-
- "**/*.js"
77-
- "**/*.ts"
78-
- "**/*.vue"
76+
- "*.js"
77+
- "*.ts"
78+
- "web_src/**"
7979

8080
docs-update-needed:
8181
- changed-files:

.github/workflows/files-changed.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ jobs:
5151
- "options/locale/locale_en-US.ini"
5252
5353
frontend:
54-
- "**/*.js"
54+
- "*.js"
55+
- "*.ts"
5556
- "web_src/**"
57+
- "tools/*.js"
58+
- "tools/*.ts"
5659
- "assets/emoji.json"
5760
- "package.json"
5861
- "package-lock.json"
5962
- "Makefile"
60-
- ".eslintrc.yaml"
61-
- "stylelint.config.js"
63+
- ".eslintrc.cjs"
6264
- ".npmrc"
6365
6466
docs:

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,9 @@ tidy-check: tidy
470470
go-licenses: $(GO_LICENSE_FILE) ## regenerate go licenses
471471

472472
$(GO_LICENSE_FILE): go.mod go.sum
473-
-$(GO) run $(GO_LICENSES_PACKAGE) save . --force --save_path=$(GO_LICENSE_TMP_DIR) 2>/dev/null
473+
@rm -rf $(GO_LICENSE_FILE)
474+
$(GO) install $(GO_LICENSES_PACKAGE)
475+
-GOOS=linux CGO_ENABLED=1 go-licenses save . --force --save_path=$(GO_LICENSE_TMP_DIR) 2>/dev/null
474476
$(GO) run build/generate-go-licenses.go $(GO_LICENSE_TMP_DIR) $(GO_LICENSE_FILE)
475477
@rm -rf $(GO_LICENSE_TMP_DIR)
476478

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ go 1.24
88
godebug x509negativeserial=1
99

1010
require (
11-
code.gitea.io/actions-proto-go v0.4.1-0.20250224031915-32cdcf1b5f71
11+
code.gitea.io/actions-proto-go v0.4.1
1212
code.gitea.io/gitea-vet v0.2.3
1313
code.gitea.io/sdk/gitea v0.20.0
1414
codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570
@@ -24,7 +24,7 @@ require (
2424
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0
2525
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.0
2626
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358
27-
github.com/ProtonMail/go-crypto v1.1.5
27+
github.com/ProtonMail/go-crypto v1.1.6
2828
github.com/PuerkitoBio/goquery v1.10.2
2929
github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.7.3
3030
github.com/alecthomas/chroma/v2 v2.15.0
@@ -318,7 +318,7 @@ replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1
318318

319319
replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142115-2c99e1ffdfa0
320320

321-
replace github.com/nektos/act => gitea.com/gitea/act v0.261.3
321+
replace github.com/nektos/act => gitea.com/gitea/act v0.261.4
322322

323323
// TODO: the only difference is in `PutObject`: the fork doesn't use `NewVerifyingReader(r, sha256.New(), oid, expectedSize)`, need to figure out why
324324
replace github.com/charmbracelet/git-lfs-transfer => gitea.com/gitea/git-lfs-transfer v0.2.0

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=
22
cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=
3-
code.gitea.io/actions-proto-go v0.4.1-0.20250224031915-32cdcf1b5f71 h1:tpcCWq2GLmRCY4zUqXNzQpZlh3AId4jXVsItRppzfuU=
4-
code.gitea.io/actions-proto-go v0.4.1-0.20250224031915-32cdcf1b5f71/go.mod h1:mn7Wkqz6JbnTOHQpot3yDeHx+O5C9EGhMEE+htvHBas=
3+
code.gitea.io/actions-proto-go v0.4.1 h1:l0EYhjsgpUe/1VABo2eK7zcoNX2W44WOnb0MSLrKfls=
4+
code.gitea.io/actions-proto-go v0.4.1/go.mod h1:mn7Wkqz6JbnTOHQpot3yDeHx+O5C9EGhMEE+htvHBas=
55
code.gitea.io/gitea-vet v0.2.3 h1:gdFmm6WOTM65rE8FUBTRzeQZYzXePKSSB1+r574hWwI=
66
code.gitea.io/gitea-vet v0.2.3/go.mod h1:zcNbT/aJEmivCAhfmkHOlT645KNOf9W2KnkLgFjGGfE=
77
code.gitea.io/sdk/gitea v0.20.0 h1:Zm/QDwwZK1awoM4AxdjeAQbxolzx2rIP8dDfmKu+KoU=
@@ -16,8 +16,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
1616
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
1717
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 h1:cliQ4HHsCo6xi2oWZYKWW4bly/Ory9FuTpFPRxj/mAg=
1818
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078/go.mod h1:g/V2Hjas6Z1UHUp4yIx6bATpNzJ7DYtD0FG3+xARWxs=
19-
gitea.com/gitea/act v0.261.3 h1:BhiYpGJQKGq0XMYYICCYAN4KnsEWHyLbA6dxhZwFcV4=
20-
gitea.com/gitea/act v0.261.3/go.mod h1:Pg5C9kQY1CEA3QjthjhlrqOC/QOT5NyWNjOjRHw23Ok=
19+
gitea.com/gitea/act v0.261.4 h1:Tf9eLlvsYFtKcpuxlMvf9yT3g4Hshb2Beqw6C1STuH8=
20+
gitea.com/gitea/act v0.261.4/go.mod h1:Pg5C9kQY1CEA3QjthjhlrqOC/QOT5NyWNjOjRHw23Ok=
2121
gitea.com/gitea/git-lfs-transfer v0.2.0 h1:baHaNoBSRaeq/xKayEXwiDQtlIjps4Ac/Ll4KqLMB40=
2222
gitea.com/gitea/git-lfs-transfer v0.2.0/go.mod h1:UrXUCm3xLQkq15fu7qlXHUMlrhdlXHoi13KH2Dfiits=
2323
gitea.com/go-chi/binding v0.0.0-20240430071103-39a851e106ed h1:EZZBtilMLSZNWtHHcgq2mt6NSGhJSZBuduAlinMEmso=
@@ -71,8 +71,8 @@ github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSC
7171
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
7272
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
7373
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
74-
github.com/ProtonMail/go-crypto v1.1.5 h1:eoAQfK2dwL+tFSFpr7TbOaPNUbPiJj4fLYwwGE1FQO4=
75-
github.com/ProtonMail/go-crypto v1.1.5/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
74+
github.com/ProtonMail/go-crypto v1.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw=
75+
github.com/ProtonMail/go-crypto v1.1.6/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
7676
github.com/PuerkitoBio/goquery v1.10.2 h1:7fh2BdHcG6VFZsK7toXBT/Bh1z5Wmy8Q9MV9HqT2AM8=
7777
github.com/PuerkitoBio/goquery v1.10.2/go.mod h1:0guWGjcLu9AYC7C1GHnpysHy056u9aEkUHwhdnePMCU=
7878
github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo=

models/auth/access_token_scope.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package auth
55

66
import (
77
"fmt"
8+
"slices"
89
"strings"
910

1011
"code.gitea.io/gitea/models/perm"
@@ -14,7 +15,7 @@ import (
1415
type AccessTokenScopeCategory int
1516

1617
const (
17-
AccessTokenScopeCategoryActivityPub = iota
18+
AccessTokenScopeCategoryActivityPub AccessTokenScopeCategory = iota
1819
AccessTokenScopeCategoryAdmin
1920
AccessTokenScopeCategoryMisc // WARN: this is now just a placeholder, don't remove it which will change the following values
2021
AccessTokenScopeCategoryNotification
@@ -193,6 +194,14 @@ var accessTokenScopes = map[AccessTokenScopeLevel]map[AccessTokenScopeCategory]A
193194
},
194195
}
195196

197+
func GetAccessTokenCategories() (res []string) {
198+
for _, cat := range accessTokenScopes[Read] {
199+
res = append(res, strings.TrimPrefix(string(cat), "read:"))
200+
}
201+
slices.Sort(res)
202+
return res
203+
}
204+
196205
// GetRequiredScopes gets the specific scopes for a given level and categories
197206
func GetRequiredScopes(level AccessTokenScopeLevel, scopeCategories ...AccessTokenScopeCategory) []AccessTokenScope {
198207
scopes := make([]AccessTokenScope, 0, len(scopeCategories))
@@ -270,6 +279,9 @@ func (s AccessTokenScope) parse() (accessTokenScopeBitmap, error) {
270279

271280
// StringSlice returns the AccessTokenScope as a []string
272281
func (s AccessTokenScope) StringSlice() []string {
282+
if s == "" {
283+
return nil
284+
}
273285
return strings.Split(string(s), ",")
274286
}
275287

models/auth/access_token_scope_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type scopeTestNormalize struct {
1717
}
1818

1919
func TestAccessTokenScope_Normalize(t *testing.T) {
20+
assert.Equal(t, []string{"activitypub", "admin", "issue", "misc", "notification", "organization", "package", "repository", "user"}, GetAccessTokenCategories())
2021
tests := []scopeTestNormalize{
2122
{"", "", nil},
2223
{"write:misc,write:notification,read:package,write:notification,public-only", "public-only,write:misc,write:notification,read:package", nil},
@@ -25,7 +26,7 @@ func TestAccessTokenScope_Normalize(t *testing.T) {
2526
{"write:activitypub,write:admin,write:misc,write:notification,write:organization,write:package,write:issue,write:repository,write:user,public-only", "public-only,all", nil},
2627
}
2728

28-
for _, scope := range []string{"activitypub", "admin", "misc", "notification", "organization", "package", "issue", "repository", "user"} {
29+
for _, scope := range GetAccessTokenCategories() {
2930
tests = append(tests,
3031
scopeTestNormalize{AccessTokenScope(fmt.Sprintf("read:%s", scope)), AccessTokenScope(fmt.Sprintf("read:%s", scope)), nil},
3132
scopeTestNormalize{AccessTokenScope(fmt.Sprintf("write:%s", scope)), AccessTokenScope(fmt.Sprintf("write:%s", scope)), nil},
@@ -59,7 +60,7 @@ func TestAccessTokenScope_HasScope(t *testing.T) {
5960
{"public-only", "read:issue", false, nil},
6061
}
6162

62-
for _, scope := range []string{"activitypub", "admin", "misc", "notification", "organization", "package", "issue", "repository", "user"} {
63+
for _, scope := range GetAccessTokenCategories() {
6364
tests = append(tests,
6465
scopeTestHasScope{
6566
AccessTokenScope(fmt.Sprintf("read:%s", scope)),

models/issues/pull_list.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@ type PullRequestsOptions struct {
2828
Labels []int64
2929
MilestoneID int64
3030
PosterID int64
31+
BaseBranch string
3132
}
3233

3334
func listPullRequestStatement(ctx context.Context, baseRepoID int64, opts *PullRequestsOptions) *xorm.Session {
3435
sess := db.GetEngine(ctx).Where("pull_request.base_repo_id=?", baseRepoID)
3536

37+
if opts.BaseBranch != "" {
38+
sess.And("pull_request.base_branch=?", opts.BaseBranch)
39+
}
40+
3641
sess.Join("INNER", "issue", "pull_request.issue_id = issue.id")
3742
switch opts.State {
3843
case "closed", "open":

models/packages/descriptor.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,12 @@ func GetPackageDescriptor(ctx context.Context, pv *PackageVersion) (*PackageDesc
110110
if err != nil {
111111
return nil, err
112112
}
113-
repository, err := repo_model.GetRepositoryByID(ctx, p.RepoID)
114-
if err != nil && !repo_model.IsErrRepoNotExist(err) {
115-
return nil, err
113+
var repository *repo_model.Repository
114+
if p.RepoID > 0 {
115+
repository, err = repo_model.GetRepositoryByID(ctx, p.RepoID)
116+
if err != nil && !repo_model.IsErrRepoNotExist(err) {
117+
return nil, err
118+
}
116119
}
117120
creator, err := user_model.GetUserByID(ctx, pv.CreatorID)
118121
if err != nil {

0 commit comments

Comments
 (0)