Skip to content

Commit 3fbe4f9

Browse files
authored
Merge branch 'main' into update-i.8713187.xyz/google/go-github
2 parents d20e49f + 5b89670 commit 3fbe4f9

File tree

27 files changed

+654
-178
lines changed

27 files changed

+654
-178
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142
289289

290290
replace github.com/blevesearch/zapx/v15 v15.3.6 => github.com/zeripath/zapx/v15 v15.3.6-alignment-fix
291291

292-
replace github.com/nektos/act => gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab
292+
replace github.com/nektos/act => gitea.com/gitea/act v0.243.3-0.20230407083103-5c4a96bcb797
293293

294294
exclude github.com/gofrs/uuid v3.2.0+incompatible
295295

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570/go.mod h1:IIAjsi
5252
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
5353
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 h1:cliQ4HHsCo6xi2oWZYKWW4bly/Ory9FuTpFPRxj/mAg=
5454
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078/go.mod h1:g/V2Hjas6Z1UHUp4yIx6bATpNzJ7DYtD0FG3+xARWxs=
55-
gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab h1:HDImhO/XpMJrw2PJcADI/wgur9Gro/pegLFaRt8Wpg0=
56-
gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab/go.mod h1:mabw6AZAiDgxGlK83orWLrNERSPvgBJzEUS3S7u2bHI=
55+
gitea.com/gitea/act v0.243.3-0.20230407083103-5c4a96bcb797 h1:QdQ+pHxpbIi2qsgZbYVxqYV7trfW3P5M/T4AfpoM7iw=
56+
gitea.com/gitea/act v0.243.3-0.20230407083103-5c4a96bcb797/go.mod h1:mabw6AZAiDgxGlK83orWLrNERSPvgBJzEUS3S7u2bHI=
5757
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681 h1:MMSPgnVULVwV9kEBgvyEUhC9v/uviZ55hPJEMjpbNR4=
5858
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681/go.mod h1:77TZu701zMXWJFvB8gvTbQ92zQ3DQq/H7l5wAEjQRKc=
5959
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e/go.mod h1:k2V/gPDEtXGjjMGuBJiapffAXTv76H4snSmlJRLUhH0=

models/fixtures/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,12 @@
6464
repo_id: 1700 # dangling intentional
6565
is_private: false
6666
created_unix: 1603011541
67+
68+
- id: 9
69+
user_id: 34
70+
op_type: 12 # close issue
71+
act_user_id: 34
72+
repo_id: 1 # public
73+
is_private: false
74+
created_unix: 1680454039
75+
content: '4|' # issueId 5

models/fixtures/user.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,3 +1220,41 @@
12201220
repo_admin_change_team_access: false
12211221
theme: ""
12221222
keep_activity_private: false
1223+
1224+
-
1225+
id: 34
1226+
lower_name: the_34-user.with.all.allowedchars
1227+
name: the_34-user.with.all.allowedChars
1228+
full_name: the_1-user.with.all.allowedChars
1229+
description: 'some [commonmark](https://commonmark.org/)!'
1230+
1231+
keep_email_private: false
1232+
email_notifications_preference: enabled
1233+
passwd: ZogKvWdyEx:password
1234+
passwd_hash_algo: dummy
1235+
must_change_password: false
1236+
login_source: 0
1237+
login_name: the_34-user.with.all.allowedchars
1238+
type: 0
1239+
salt: ZogKvWdyEx
1240+
max_repo_creation: -1
1241+
is_active: true
1242+
is_admin: false
1243+
is_restricted: false
1244+
allow_git_hook: false
1245+
allow_import_local: false
1246+
allow_create_organization: false
1247+
prohibit_login: false
1248+
avatar: avatar34
1249+
avatar_email: [email protected]
1250+
use_custom_avatar: true
1251+
num_followers: 0
1252+
num_following: 0
1253+
num_stars: 0
1254+
num_repos: 0
1255+
num_teams: 0
1256+
num_members: 0
1257+
visibility: 0
1258+
repo_admin_change_team_access: false
1259+
theme: ""
1260+
keep_activity_private: false

models/user/user_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ func TestSearchUsers(t *testing.T) {
9999
}
100100

101101
testUserSuccess(&user_model.SearchUserOptions{OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}},
102-
[]int64{1, 2, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30, 32})
102+
[]int64{1, 2, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30, 32, 34})
103103

104104
testUserSuccess(&user_model.SearchUserOptions{ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolFalse},
105105
[]int64{9})
106106

107107
testUserSuccess(&user_model.SearchUserOptions{OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolTrue},
108-
[]int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30, 32})
108+
[]int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30, 32, 34})
109109

110110
testUserSuccess(&user_model.SearchUserOptions{Keyword: "user1", OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolTrue},
111111
[]int64{1, 10, 11, 12, 13, 14, 15, 16, 18})

modules/actions/workflows.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,18 @@ import (
1717
"github.com/nektos/act/pkg/jobparser"
1818
"github.com/nektos/act/pkg/model"
1919
"github.com/nektos/act/pkg/workflowpattern"
20+
"gopkg.in/yaml.v3"
2021
)
2122

23+
func init() {
24+
model.OnDecodeNodeError = func(node yaml.Node, out interface{}, err error) {
25+
// Log the error instead of panic or fatal.
26+
// It will be a big job to refactor act/pkg/model to return decode error,
27+
// so we just log the error and return empty value, and improve it later.
28+
log.Error("Failed to decode node %v into %T: %v", node, out, err)
29+
}
30+
}
31+
2232
func ListWorkflows(commit *git.Commit) (git.Entries, error) {
2333
tree, err := commit.SubTree(".gitea/workflows")
2434
if _, ok := err.(git.ErrNotExist); ok {

modules/base/tool.go

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -141,55 +141,6 @@ func FileSize(s int64) string {
141141
return humanize.IBytes(uint64(s))
142142
}
143143

144-
// Subtract deals with subtraction of all types of number.
145-
func Subtract(left, right interface{}) interface{} {
146-
var rleft, rright int64
147-
var fleft, fright float64
148-
isInt := true
149-
switch v := left.(type) {
150-
case int:
151-
rleft = int64(v)
152-
case int8:
153-
rleft = int64(v)
154-
case int16:
155-
rleft = int64(v)
156-
case int32:
157-
rleft = int64(v)
158-
case int64:
159-
rleft = v
160-
case float32:
161-
fleft = float64(v)
162-
isInt = false
163-
case float64:
164-
fleft = v
165-
isInt = false
166-
}
167-
168-
switch v := right.(type) {
169-
case int:
170-
rright = int64(v)
171-
case int8:
172-
rright = int64(v)
173-
case int16:
174-
rright = int64(v)
175-
case int32:
176-
rright = int64(v)
177-
case int64:
178-
rright = v
179-
case float32:
180-
fright = float64(v)
181-
isInt = false
182-
case float64:
183-
fright = v
184-
isInt = false
185-
}
186-
187-
if isInt {
188-
return rleft - rright
189-
}
190-
return fleft + float64(rleft) - (fright + float64(rright))
191-
}
192-
193144
// EllipsisString returns a truncated short string,
194145
// it appends '...' in the end of the length of string is too large.
195146
func EllipsisString(str string, length int) string {

modules/base/tool_test.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -114,45 +114,6 @@ func TestFileSize(t *testing.T) {
114114
assert.Equal(t, "2.0 EiB", FileSize(size))
115115
}
116116

117-
func TestSubtract(t *testing.T) {
118-
toFloat64 := func(n interface{}) float64 {
119-
switch v := n.(type) {
120-
case int:
121-
return float64(v)
122-
case int8:
123-
return float64(v)
124-
case int16:
125-
return float64(v)
126-
case int32:
127-
return float64(v)
128-
case int64:
129-
return float64(v)
130-
case float32:
131-
return float64(v)
132-
case float64:
133-
return v
134-
default:
135-
return 0.0
136-
}
137-
}
138-
values := []interface{}{
139-
int(-3),
140-
int8(14),
141-
int16(81),
142-
int32(-156),
143-
int64(1528),
144-
float32(3.5),
145-
float64(-15.348),
146-
}
147-
for _, left := range values {
148-
for _, right := range values {
149-
expected := toFloat64(left) - toFloat64(right)
150-
sub := Subtract(left, right)
151-
assert.InDelta(t, expected, sub, 1e-3)
152-
}
153-
}
154-
}
155-
156117
func TestEllipsisString(t *testing.T) {
157118
assert.Equal(t, "...", EllipsisString("foobar", 0))
158119
assert.Equal(t, "...", EllipsisString("foobar", 1))

modules/context/repo.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,11 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
537537
ctx.Data["RepoLink"] = ctx.Repo.RepoLink
538538
ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name
539539

540+
if setting.EnableFeed {
541+
ctx.Data["EnableFeed"] = true
542+
ctx.Data["FeedURL"] = ctx.Repo.RepoLink
543+
}
544+
540545
unit, err := ctx.Repo.Repository.GetUnit(ctx, unit_model.TypeExternalTracker)
541546
if err == nil {
542547
ctx.Data["RepoExternalIssuesLink"] = unit.ExternalTrackerConfig().ExternalTrackerURL

0 commit comments

Comments
 (0)