Skip to content

Commit 688bd6d

Browse files
committed
lint & fix test
1 parent d2d51c4 commit 688bd6d

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

models/fixtures/action_run.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,15 @@
142142
-
143143
id: 804
144144
title: "use a private action"
145-
repo_id: 6
146-
owner_id: 10
145+
repo_id: 60
146+
owner_id: 40
147147
workflow_id: "run.yaml"
148148
index: 189
149-
trigger_user_id: 10
149+
trigger_user_id: 40
150150
ref: "refs/heads/master"
151151
commit_sha: "6e64b26de7ba966d01d90ecfaf5c7f14ef203e86"
152152
event: "push"
153+
trigger_event: "push"
153154
is_fork_pull_request: 0
154155
status: 1
155156
started: 1683636528

routers/web/repo/setting/actions.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package setting
55

66
import (
77
"errors"
8-
"fmt"
98
"net/http"
109
"strings"
1110

@@ -43,7 +42,7 @@ func ActionsGeneralSettings(ctx *context.Context) {
4342
}
4443

4544
func AddCollaborativeOwner(ctx *context.Context) {
46-
redirectURL := fmt.Sprintf("%s/settings/actions/general", ctx.Repo.RepoLink)
45+
redirectURL := ctx.Repo.RepoLink + "/settings/actions/general"
4746
name := strings.ToLower(ctx.FormString("collaborative_owner"))
4847

4948
ownerID, err := user_model.GetUserOrOrgIDByName(ctx, name)
@@ -73,7 +72,7 @@ func AddCollaborativeOwner(ctx *context.Context) {
7372
}
7473

7574
func DeleteCollaborativeOwner(ctx *context.Context) {
76-
redirectURL := fmt.Sprintf("%s/settings/actions/general", ctx.Repo.RepoLink)
75+
redirectURL := ctx.Repo.RepoLink + "/settings/actions/general"
7776
ownerID := ctx.FormInt64("id")
7877

7978
actionsUnit, err := ctx.Repo.Repository.GetUnit(ctx, unit_model.TypeActions)

tests/integration/actions_settings_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"net/http"
99
"net/url"
10+
"strconv"
1011
"testing"
1112

1213
repo_model "code.gitea.io/gitea/models/repo"
@@ -49,12 +50,12 @@ func TestActionsCollaborativeOwner(t *testing.T) {
4950
// remove user10 from the list of collaborative owners
5051
req = NewRequestWithValues(t, "POST", fmt.Sprintf("/%s/%s/settings/actions/general/collaborative_owner/delete", actionRepo.OwnerName, actionRepo.Name), map[string]string{
5152
"_csrf": user2CSRF,
52-
"id": fmt.Sprintf("%d", user10.ID),
53+
"id": strconv.FormatInt(user10.ID, 10),
5354
})
5455
resp := user2Session.MakeRequest(t, req, http.StatusOK)
5556
res := make(map[string]string)
5657
assert.NoError(t, json.NewDecoder(resp.Body).Decode(&res))
57-
assert.EqualValues(t, fmt.Sprintf("/%s/%s/settings/actions/general", actionRepo.OwnerName, actionRepo.Name), res["redirect"])
58+
assert.Equal(t, fmt.Sprintf("/%s/%s/settings/actions/general", actionRepo.OwnerName, actionRepo.Name), res["redirect"])
5859

5960
// the git clone will fail
6061
doGitCloneFail(u)(t)

0 commit comments

Comments
 (0)