diff --git a/.github/workflows/disk-clean.yml b/.github/workflows/disk-clean.yml deleted file mode 100644 index 8abe8891c7..0000000000 --- a/.github/workflows/disk-clean.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: disk-clean - -on: - workflow_call: - -jobs: - triage: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@main - with: - # this might remove tools that are actually needed, - # if set to "true" but frees about 6 GB - tool-cache: false - - # all of these default to true, but feel free to set to - # "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: false - swap-storage: true diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index 990f3c8e07..fbaa27102c 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -9,8 +9,6 @@ concurrency: cancel-in-progress: true jobs: - disk-clean: - uses: ./.github/workflows/disk-clean.yml nightly-binary: runs-on: nscloud steps: diff --git a/assets/go-licenses.json b/assets/go-licenses.json index db94ea0d7d..b8905da284 100644 --- a/assets/go-licenses.json +++ b/assets/go-licenses.json @@ -540,8 +540,8 @@ "licenseText": "Copyright (c) 2011 The Snappy-Go Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" }, { - "name": "github.com/google/go-github/v57/github", - "path": "github.com/google/go-github/v57/github/LICENSE", + "name": "github.com/google/go-github/v61/github", + "path": "github.com/google/go-github/v61/github/LICENSE", "licenseText": "Copyright (c) 2013 The go-github AUTHORS. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" }, { diff --git a/contrib/backport/backport.go b/contrib/backport/backport.go index 820c0702b7..9ae4483d8b 100644 --- a/contrib/backport/backport.go +++ b/contrib/backport/backport.go @@ -17,7 +17,7 @@ import ( "strings" "syscall" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v61/github" "github.com/urfave/cli/v2" "gopkg.in/yaml.v3" ) diff --git a/go.mod b/go.mod index 1e88de3011..2c1fc5d6f2 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4 github.com/42wim/sshsig v0.0.0-20211121163825-841cf5bbc121 github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 + github.com/ProtonMail/go-crypto v1.0.0 github.com/PuerkitoBio/goquery v1.9.1 github.com/alecthomas/chroma/v2 v2.13.0 github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb @@ -53,7 +54,7 @@ require ( github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85 github.com/golang-jwt/jwt/v5 v5.2.1 - github.com/google/go-github/v57 v57.0.0 + github.com/google/go-github/v61 v61.0.0 github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 github.com/google/uuid v1.6.0 github.com/gorilla/feeds v1.1.2 @@ -135,7 +136,6 @@ require ( github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/ProtonMail/go-crypto v1.0.0 // indirect github.com/RoaringBitmap/roaring v1.9.0 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/andybalholm/cascadia v1.3.2 // indirect diff --git a/go.sum b/go.sum index cbf397b95c..8c26b4a7a6 100644 --- a/go.sum +++ b/go.sum @@ -394,8 +394,8 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v57 v57.0.0 h1:L+Y3UPTY8ALM8x+TV0lg+IEBI+upibemtBD8Q9u7zHs= -github.com/google/go-github/v57 v57.0.0/go.mod h1:s0omdnye0hvK/ecLvpsGfJMiRt85PimQh4oygmLIxHw= +github.com/google/go-github/v61 v61.0.0 h1:VwQCBwhyE9JclCI+22/7mLB1PuU9eowCXKY5pNlu1go= +github.com/google/go-github/v61 v61.0.0/go.mod h1:0WR+KmsWX75G2EbpyGsGmradjo3IiciuI4BmdVCobQY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/go-tpm v0.9.0 h1:sQF6YqWMi+SCXpsmS3fd21oPy/vSddwZry4JnmltHVk= diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 220d8c2331..4501585250 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -21,7 +21,6 @@ import ( "code.gitea.io/gitea/models/migrations/v1_20" "code.gitea.io/gitea/models/migrations/v1_21" "code.gitea.io/gitea/models/migrations/v1_22" - "code.gitea.io/gitea/models/migrations/v1_23" "code.gitea.io/gitea/models/migrations/v1_6" "code.gitea.io/gitea/models/migrations/v1_7" "code.gitea.io/gitea/models/migrations/v1_8" @@ -574,18 +573,20 @@ var migrations = []Migration{ // v293 -> v294 NewMigration("Ensure every project has exactly one default column", v1_22.CheckProjectColumnsConsistency), - // Gitea 1.22.0 ends at 294 + // Gitea 1.22.0-rc0 ends at 294 // v294 -> v295 - NewMigration("Add unique index for project issue table", v1_23.AddUniqueIndexForProjectIssue), + NewMigration("Add unique index for project issue table", v1_22.AddUniqueIndexForProjectIssue), // v295 -> v296 - NewMigration("Add commit status summary table", v1_23.AddCommitStatusSummary), + NewMigration("Add commit status summary table", v1_22.AddCommitStatusSummary), // v296 -> v297 - NewMigration("Add missing field of commit status summary table", v1_23.AddCommitStatusSummary2), + NewMigration("Add missing field of commit status summary table", v1_22.AddCommitStatusSummary2), // v297 -> v298 - NewMigration("Add everyone_access_mode for repo_unit", v1_23.AddRepoUnitEveryoneAccessMode), + NewMigration("Add everyone_access_mode for repo_unit", v1_22.AddRepoUnitEveryoneAccessMode), // v298 -> v299 - NewMigration("Drop wrongly created table o_auth2_application", v1_23.DropWronglyCreatedTable), + NewMigration("Drop wrongly created table o_auth2_application", v1_22.DropWronglyCreatedTable), + + // Gitea 1.22.0-rc1 ends at 299 } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v1_23/v294.go b/models/migrations/v1_22/v294.go similarity index 98% rename from models/migrations/v1_23/v294.go rename to models/migrations/v1_22/v294.go index f2a54f6d23..20e261fb1b 100644 --- a/models/migrations/v1_23/v294.go +++ b/models/migrations/v1_22/v294.go @@ -1,7 +1,7 @@ // Copyright 2024 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_23 //nolint +package v1_22 //nolint import ( "fmt" diff --git a/models/migrations/v1_23/v294_test.go b/models/migrations/v1_22/v294_test.go similarity index 98% rename from models/migrations/v1_23/v294_test.go rename to models/migrations/v1_22/v294_test.go index d9a44ad866..82a3bcd602 100644 --- a/models/migrations/v1_23/v294_test.go +++ b/models/migrations/v1_22/v294_test.go @@ -1,7 +1,7 @@ // Copyright 2024 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_23 //nolint +package v1_22 //nolint import ( "slices" diff --git a/models/migrations/v1_23/v295.go b/models/migrations/v1_22/v295.go similarity index 96% rename from models/migrations/v1_23/v295.go rename to models/migrations/v1_22/v295.go index 9a2003cfc1..17bdadb4ad 100644 --- a/models/migrations/v1_23/v295.go +++ b/models/migrations/v1_22/v295.go @@ -1,7 +1,7 @@ // Copyright 2024 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_23 //nolint +package v1_22 //nolint import "xorm.io/xorm" diff --git a/models/migrations/v1_23/v296.go b/models/migrations/v1_22/v296.go similarity index 95% rename from models/migrations/v1_23/v296.go rename to models/migrations/v1_22/v296.go index 495ae2ab23..1ecacab95f 100644 --- a/models/migrations/v1_23/v296.go +++ b/models/migrations/v1_22/v296.go @@ -1,7 +1,7 @@ // Copyright 2024 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_23 //nolint +package v1_22 //nolint import "xorm.io/xorm" diff --git a/models/migrations/v1_23/v297.go b/models/migrations/v1_22/v297.go similarity index 94% rename from models/migrations/v1_23/v297.go rename to models/migrations/v1_22/v297.go index e79f04cf9c..7d4b506925 100644 --- a/models/migrations/v1_23/v297.go +++ b/models/migrations/v1_22/v297.go @@ -1,7 +1,7 @@ // Copyright 2024 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_23 //nolint +package v1_22 //nolint import ( "code.gitea.io/gitea/models/perm" diff --git a/models/migrations/v1_23/v298.go b/models/migrations/v1_22/v298.go similarity index 90% rename from models/migrations/v1_23/v298.go rename to models/migrations/v1_22/v298.go index 8761a05d3d..b9f3b95ade 100644 --- a/models/migrations/v1_23/v298.go +++ b/models/migrations/v1_22/v298.go @@ -1,7 +1,7 @@ // Copyright 2024 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_23 //nolint +package v1_22 //nolint import "xorm.io/xorm" diff --git a/models/user/user_test.go b/models/user/user_test.go index b4ffa1f322..c4e278caab 100644 --- a/models/user/user_test.go +++ b/models/user/user_test.go @@ -5,8 +5,8 @@ package user_test import ( "context" + "crypto/rand" "fmt" - "math/rand" "strings" "testing" "time" diff --git a/modules/auth/password/pwn/pwn_test.go b/modules/auth/password/pwn/pwn_test.go index f9deadc8d7..a2a6b3a174 100644 --- a/modules/auth/password/pwn/pwn_test.go +++ b/modules/auth/password/pwn/pwn_test.go @@ -4,9 +4,8 @@ package pwn import ( - "math/rand" + "math/rand/v2" "net/http" - "os" "strings" "testing" "time" @@ -18,11 +17,6 @@ var client = New(WithHTTP(&http.Client{ Timeout: time.Second * 2, })) -func TestMain(m *testing.M) { - rand.Seed(time.Now().Unix()) - os.Exit(m.Run()) -} - func TestPassword(t *testing.T) { // Check input error _, err := client.CheckPassword("", false) @@ -81,24 +75,24 @@ func testPassword() string { // Set special character for i := 0; i < 5; i++ { - random := rand.Intn(len(specialCharSet)) + random := rand.IntN(len(specialCharSet)) password.WriteString(string(specialCharSet[random])) } // Set numeric for i := 0; i < 5; i++ { - random := rand.Intn(len(numberSet)) + random := rand.IntN(len(numberSet)) password.WriteString(string(numberSet[random])) } // Set uppercase for i := 0; i < 5; i++ { - random := rand.Intn(len(upperCharSet)) + random := rand.IntN(len(upperCharSet)) password.WriteString(string(upperCharSet[random])) } for i := 0; i < 5; i++ { - random := rand.Intn(len(allCharSet)) + random := rand.IntN(len(allCharSet)) password.WriteString(string(allCharSet[random])) } inRune := []rune(password.String()) diff --git a/routers/api/actions/artifacts.go b/routers/api/actions/artifacts.go index 3e717b8d8f..5bd004bd37 100644 --- a/routers/api/actions/artifacts.go +++ b/routers/api/actions/artifacts.go @@ -466,14 +466,15 @@ func (ar artifactRoutes) downloadArtifact(ctx *ArtifactContext) { log.Error("Error getting artifact: %v", err) ctx.Error(http.StatusInternalServerError, err.Error()) return - } else if !exist { + } + if !exist { log.Error("artifact with ID %d does not exist", artifactID) ctx.Error(http.StatusNotFound, fmt.Sprintf("artifact with ID %d does not exist", artifactID)) return } if artifact.RunID != runID { - log.Error("Error dismatch runID and artifactID, task: %v, artifact: %v", runID, artifactID) - ctx.Error(http.StatusBadRequest, err.Error()) + log.Error("Error mismatch runID and artifactID, task: %v, artifact: %v", runID, artifactID) + ctx.Error(http.StatusBadRequest) return } diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index 3909a64be6..12909bddd5 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -504,7 +504,7 @@ func getRunJobs(ctx *context_module.Context, runIndex, jobIndex int64) (*actions return nil, nil } if len(jobs) == 0 { - ctx.Error(http.StatusNotFound, err.Error()) + ctx.Error(http.StatusNotFound) return nil, nil } diff --git a/services/migrations/error.go b/services/migrations/error.go index 5e0e0742c9..c7d912f50b 100644 --- a/services/migrations/error.go +++ b/services/migrations/error.go @@ -7,7 +7,7 @@ package migrations import ( "errors" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v61/github" ) // ErrRepoNotCreated returns the error that repository not created diff --git a/services/migrations/github.go b/services/migrations/github.go index be573b33b3..a36b02ca8b 100644 --- a/services/migrations/github.go +++ b/services/migrations/github.go @@ -20,7 +20,7 @@ import ( "code.gitea.io/gitea/modules/proxy" "code.gitea.io/gitea/modules/structs" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v61/github" "golang.org/x/oauth2" ) diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl index 589fc5048a..3445433d53 100644 --- a/templates/admin/dashboard.tmpl +++ b/templates/admin/dashboard.tmpl @@ -76,7 +76,8 @@ {{ctx.Locale.Tr "admin.dashboard.system_status"}} {{/* TODO: make these stats work in multi-server deployments, likely needs per-server stats in DB */}} -
+
+
{{template "admin/system_status" .}}
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 92a3163642..641de294fd 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -235,7 +235,7 @@ {{if and (not $.Repository.IsArchived) (not .DiffNotAvailable)}} diff --git a/templates/repo/issue/card.tmpl b/templates/repo/issue/card.tmpl index bb9340bb2e..4a0ac050aa 100644 --- a/templates/repo/issue/card.tmpl +++ b/templates/repo/issue/card.tmpl @@ -1,13 +1,16 @@ {{with .Issue}} {{if eq $.Page.Project.CardType 1}}{{/* Images and Text*/}} + {{$attachments := index $.Page.issuesAttachmentMap .ID}} + {{if $attachments}}
- {{range (index $.Page.issuesAttachmentMap .ID)}} + {{range $attachments}} {{.Name}} {{end}}
+ {{end}} {{end}} -
-
+
+
{{template "shared/issueicon" .}}
@@ -18,7 +21,7 @@ {{end}}
-
+
{{if not $.Page.Repository}}{{.Repo.FullName}}{{end}}#{{.Index}} {{$timeStr := TimeSinceUnix .GetLastEventTimestamp ctx.Locale}} @@ -59,13 +62,15 @@
{{if or .Labels .Assignees}} -
- {{range .Labels}} - {{RenderLabel ctx ctx.Locale .}} - {{end}} -
+
+
+ {{range .Labels}} + {{RenderLabel ctx ctx.Locale .}} + {{end}} +
+
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 8316df2ee1..d40134ed08 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -146,7 +146,7 @@