Skip to content

Commit 00bbc8f

Browse files
ecruppertimhuynh94
andauthored
enhance(repo): update validation to include first-time option (#535)
Co-authored-by: Tim Huynh <[email protected]>
1 parent db6080d commit 00bbc8f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

action/repo/validate.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ func (c *Config) Validate() error {
3434
if len(c.ApproveBuild) > 0 &&
3535
c.ApproveBuild != constants.ApproveForkAlways &&
3636
c.ApproveBuild != constants.ApproveForkNoWrite &&
37+
c.ApproveBuild != constants.ApproveOnce &&
3738
c.ApproveBuild != constants.ApproveNever {
3839
return fmt.Errorf(
39-
"invalid input for approve-build: must be `%s`, `%s`, or `%s`",
40+
"invalid input for approve-build: must be `%s`, `%s`, `%s`, or `%s`",
4041
constants.ApproveForkAlways,
4142
constants.ApproveForkNoWrite,
43+
constants.ApproveOnce,
4244
constants.ApproveNever,
4345
)
4446
}

action/repo/validate_test.go

+19
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,25 @@ func TestRepo_Config_Validate(t *testing.T) {
9696
Output: "",
9797
},
9898
},
99+
{
100+
failure: false,
101+
config: &Config{
102+
Action: "update",
103+
Org: "github",
104+
Name: "octocat",
105+
Link: "https://github.com/github/octocat",
106+
Clone: "https://github.com/github/octocat.git",
107+
Branch: "main",
108+
Timeout: 60,
109+
Visibility: "public",
110+
Private: false,
111+
Trusted: false,
112+
Active: true,
113+
Events: []string{"push", "pull_request", "comment", "deployment", "tag"},
114+
ApproveBuild: "first-time",
115+
Output: "",
116+
},
117+
},
99118
{
100119
failure: true,
101120
config: &Config{

0 commit comments

Comments
 (0)