Skip to content

Commit 8901e59

Browse files
authored
Merge branch 'main' into patch-actions-email-2
2 parents cf547bb + 793815a commit 8901e59

File tree

11 files changed

+370
-47
lines changed

11 files changed

+370
-47
lines changed

Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ ifeq ($(HAS_GO), yes)
4848
CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
4949
endif
5050

51+
CGO_ENABLED ?= 0
52+
ifneq (,$(findstring sqlite,$(TAGS))$(findstring pam,$(TAGS)))
53+
CGO_ENABLED = 1
54+
endif
55+
56+
STATIC ?=
57+
EXTLDFLAGS ?=
58+
ifneq ($(STATIC),)
59+
EXTLDFLAGS = -extldflags "-static"
60+
endif
61+
5162
ifeq ($(GOOS),windows)
5263
IS_WINDOWS := yes
5364
else ifeq ($(patsubst Windows%,Windows,$(OS)),Windows)
@@ -746,7 +757,10 @@ security-check:
746757
go run $(GOVULNCHECK_PACKAGE) -show color ./...
747758

748759
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
749-
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
760+
ifneq ($(and $(STATIC),$(findstring pam,$(TAGS))),)
761+
$(error pam support set via TAGS doesn't support static builds)
762+
endif
763+
CGO_ENABLED="$(CGO_ENABLED)" CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(EXTLDFLAGS) $(LDFLAGS)' -o $@
750764

751765
.PHONY: release
752766
release: frontend generate release-windows release-linux release-darwin release-freebsd release-copy release-compress vendor release-sources release-check

flake.nix

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,45 @@
1111
pkgs = nixpkgs.legacyPackages.${system};
1212
in
1313
{
14-
devShells.default = pkgs.mkShell {
15-
buildInputs = with pkgs; [
16-
# generic
17-
git
18-
git-lfs
19-
gnumake
20-
gnused
21-
gnutar
22-
gzip
14+
devShells.default =
15+
with pkgs;
16+
let
17+
# only bump toolchain versions here
18+
go = go_1_24;
19+
nodejs = nodejs_24;
20+
python3 = python312;
21+
in
22+
pkgs.mkShell {
23+
buildInputs = [
24+
# generic
25+
git
26+
git-lfs
27+
gnumake
28+
gnused
29+
gnutar
30+
gzip
2331

24-
# frontend
25-
nodejs_22
32+
# frontend
33+
nodejs
2634

27-
# linting
28-
python312
29-
uv
35+
# linting
36+
python3
37+
uv
3038

31-
# backend
32-
go_1_24
33-
gofumpt
34-
sqlite
35-
];
36-
shellHook = ''
37-
export GO="${pkgs.go_1_24}/bin/go"
38-
export GOROOT="${pkgs.go_1_24}/share/go"
39-
'';
40-
};
39+
# backend
40+
go
41+
glibc.static
42+
gofumpt
43+
sqlite
44+
];
45+
CFLAGS = "-I${glibc.static.dev}/include";
46+
LDFLAGS = "-L ${glibc.static}/lib";
47+
GO = "${go}/bin/go";
48+
GOROOT = "${go}/share/go";
49+
50+
TAGS = "sqlite sqlite_unlock_notify";
51+
STATIC = "true";
52+
};
4153
}
4254
);
4355
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module code.gitea.io/gitea
22

3-
go 1.24.5
3+
go 1.24.6
44

55
// rfc5280 said: "The serial number is an integer assigned by the CA to each certificate."
66
// But some CAs use negative serial number, just relax the check. related:

options/locale/locale_fr-FR.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,7 @@ commit_graph.color=Couleur
13221322
commit.contained_in=Cette révision appartient à :
13231323
commit.contained_in_default_branch=Cette révision appartient à la branche par défaut
13241324
commit.load_referencing_branches_and_tags=Charger les branches et étiquettes référençant cette révision
1325+
commit.merged_in_pr=Cette révision a été fusionnée dans la demande d’ajout %s.
13251326
blame=Annotations
13261327
download_file=Télécharger le fichier
13271328
normal_view=Vue normale

options/locale/locale_ga-IE.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,7 @@ commit_graph.color=Dath
13221322
commit.contained_in=Tá an tiomantas seo le fáil i:
13231323
commit.contained_in_default_branch=Tá an tiomantas seo mar chuid den bhrainse réamhshocraithe
13241324
commit.load_referencing_branches_and_tags=Luchtaigh brainsí agus clibeanna a thagraíonn an tiomantas
1325+
commit.merged_in_pr=Cuireadh an tiomantas seo le chéile san iarratas tarraingthe %s.
13251326
blame=An milleán
13261327
download_file=Íoslódáil comhad
13271328
normal_view=Amharc Gnáth

options/locale/locale_pt-PT.ini

Lines changed: 171 additions & 0 deletions
Large diffs are not rendered by default.

routers/api/v1/repo/action.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,18 +1132,23 @@ func GetWorkflowRun(ctx *context.APIContext) {
11321132
// "$ref": "#/responses/notFound"
11331133

11341134
runID := ctx.PathParamInt64("run")
1135-
job, _, err := db.GetByID[actions_model.ActionRun](ctx, runID)
1135+
job, has, err := db.GetByID[actions_model.ActionRun](ctx, runID)
1136+
if err != nil {
1137+
ctx.APIErrorInternal(err)
1138+
return
1139+
}
11361140

1137-
if err != nil || job.RepoID != ctx.Repo.Repository.ID {
1138-
ctx.APIError(http.StatusNotFound, util.ErrNotExist)
1141+
if !has || job.RepoID != ctx.Repo.Repository.ID {
1142+
ctx.APIErrorNotFound(util.ErrNotExist)
1143+
return
11391144
}
11401145

1141-
convertedArtifact, err := convert.ToActionWorkflowRun(ctx, ctx.Repo.Repository, job)
1146+
convertedRun, err := convert.ToActionWorkflowRun(ctx, ctx.Repo.Repository, job)
11421147
if err != nil {
11431148
ctx.APIErrorInternal(err)
11441149
return
11451150
}
1146-
ctx.JSON(http.StatusOK, convertedArtifact)
1151+
ctx.JSON(http.StatusOK, convertedRun)
11471152
}
11481153

11491154
// ListWorkflowRunJobs Lists all jobs for a workflow run.
@@ -1237,10 +1242,15 @@ func GetWorkflowJob(ctx *context.APIContext) {
12371242
// "$ref": "#/responses/notFound"
12381243

12391244
jobID := ctx.PathParamInt64("job_id")
1240-
job, _, err := db.GetByID[actions_model.ActionRunJob](ctx, jobID)
1245+
job, has, err := db.GetByID[actions_model.ActionRunJob](ctx, jobID)
1246+
if err != nil {
1247+
ctx.APIErrorInternal(err)
1248+
return
1249+
}
12411250

1242-
if err != nil || job.RepoID != ctx.Repo.Repository.ID {
1243-
ctx.APIError(http.StatusNotFound, util.ErrNotExist)
1251+
if !has || job.RepoID != ctx.Repo.Repository.ID {
1252+
ctx.APIErrorNotFound(util.ErrNotExist)
1253+
return
12441254
}
12451255

12461256
convertedWorkflowJob, err := convert.ToActionWorkflowJob(ctx, ctx.Repo.Repository, nil, job)
@@ -1251,7 +1261,7 @@ func GetWorkflowJob(ctx *context.APIContext) {
12511261
ctx.JSON(http.StatusOK, convertedWorkflowJob)
12521262
}
12531263

1254-
// GetArtifacts Lists all artifacts for a repository.
1264+
// GetArtifactsOfRun Lists all artifacts for a repository.
12551265
func GetArtifactsOfRun(ctx *context.APIContext) {
12561266
// swagger:operation GET /repos/{owner}/{repo}/actions/runs/{run}/artifacts repository getArtifactsOfRun
12571267
// ---
@@ -1354,7 +1364,7 @@ func DeleteActionRun(ctx *context.APIContext) {
13541364
runID := ctx.PathParamInt64("run")
13551365
run, err := actions_model.GetRunByRepoAndID(ctx, ctx.Repo.Repository.ID, runID)
13561366
if errors.Is(err, util.ErrNotExist) {
1357-
ctx.APIError(http.StatusNotFound, err)
1367+
ctx.APIErrorNotFound(err)
13581368
return
13591369
} else if err != nil {
13601370
ctx.APIErrorInternal(err)

templates/repo/issue/view_content/conversation.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</span>
1616
{{end}}
1717
</div>
18-
<div>
18+
<div class="tw-flex tw-items-center">
1919
{{if or $invalid $resolved}}
2020
<button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if not $resolved}}tw-hidden{{end}} btn tiny show-outdated">
2121
{{svg "octicon-unfold" 16 "tw-mr-2"}}

tests/integration/api_actions_delete_run_test.go renamed to tests/integration/api_actions_run_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,44 @@ import (
1818
"github.com/stretchr/testify/assert"
1919
)
2020

21+
func TestAPIActionsGetWorkflowRun(t *testing.T) {
22+
defer prepareTestEnvActionsArtifacts(t)()
23+
24+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2})
25+
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
26+
session := loginUser(t, user.Name)
27+
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
28+
29+
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/802802", repo.FullName())).
30+
AddTokenAuth(token)
31+
MakeRequest(t, req, http.StatusNotFound)
32+
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/802", repo.FullName())).
33+
AddTokenAuth(token)
34+
MakeRequest(t, req, http.StatusNotFound)
35+
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/803", repo.FullName())).
36+
AddTokenAuth(token)
37+
MakeRequest(t, req, http.StatusOK)
38+
}
39+
40+
func TestAPIActionsGetWorkflowJob(t *testing.T) {
41+
defer prepareTestEnvActionsArtifacts(t)()
42+
43+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2})
44+
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
45+
session := loginUser(t, user.Name)
46+
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
47+
48+
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/jobs/198198", repo.FullName())).
49+
AddTokenAuth(token)
50+
MakeRequest(t, req, http.StatusNotFound)
51+
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/jobs/198", repo.FullName())).
52+
AddTokenAuth(token)
53+
MakeRequest(t, req, http.StatusOK)
54+
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/jobs/196", repo.FullName())).
55+
AddTokenAuth(token)
56+
MakeRequest(t, req, http.StatusNotFound)
57+
}
58+
2159
func TestAPIActionsDeleteRunCheckPermission(t *testing.T) {
2260
defer prepareTestEnvActionsArtifacts(t)()
2361

tests/integration/editor_test.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestEditor(t *testing.T) {
5656

5757
func testEditorCreateFile(t *testing.T) {
5858
session := loginUser(t, "user2")
59-
testCreateFile(t, session, "user2", "repo1", "master", "test.txt", "Content")
59+
testCreateFile(t, session, "user2", "repo1", "master", "", "test.txt", "Content")
6060
testEditorActionPostRequestError(t, session, "/user2/repo1/_new/master/", map[string]string{
6161
"tree_path": "test.txt",
6262
"commit_choice": "direct",
@@ -69,11 +69,16 @@ func testEditorCreateFile(t *testing.T) {
6969
}, `Branch "master" already exists in this repository.`)
7070
}
7171

72-
func testCreateFile(t *testing.T, session *TestSession, user, repo, branch, filePath, content string) {
73-
testEditorActionEdit(t, session, user, repo, "_new", branch, "", map[string]string{
74-
"tree_path": filePath,
75-
"content": content,
76-
"commit_choice": "direct",
72+
func testCreateFile(t *testing.T, session *TestSession, user, repo, baseBranchName, newBranchName, filePath, content string) {
73+
commitChoice := "direct"
74+
if newBranchName != "" && newBranchName != baseBranchName {
75+
commitChoice = "commit-to-new-branch"
76+
}
77+
testEditorActionEdit(t, session, user, repo, "_new", baseBranchName, "", map[string]string{
78+
"tree_path": filePath,
79+
"content": content,
80+
"commit_choice": commitChoice,
81+
"new_branch_name": newBranchName,
7782
})
7883
}
7984

0 commit comments

Comments
 (0)