-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(main): fix webhook error (#9)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
- Loading branch information
1 parent
fb22c61
commit 86215c4
Showing
13 changed files
with
155 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
version: v1 | ||
debug: true | ||
type: actions | ||
bot: | ||
prefix: / | ||
spe: _ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
Copyright 2023 cuisongliu@qq.com. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package types | ||
|
||
import "fmt" | ||
|
||
func (r *Config) validate() error { | ||
if r.Bot.Username == "" { | ||
return fmt.Errorf("bot username is required") | ||
} | ||
if r.Bot.Email == "" { | ||
return fmt.Errorf("bot email is required") | ||
} | ||
|
||
if r.Type == TypeAction { | ||
if r.GetRepoName() == "" { | ||
return fmt.Errorf("repo name is required") | ||
} | ||
if r.GetForkName() == "" { | ||
return fmt.Errorf("repo fork is required") | ||
} | ||
if r.Release != nil { | ||
if r.Release.Action == "" { | ||
return fmt.Errorf("release action is required") | ||
} | ||
if r.Release.Retry == "" { | ||
return fmt.Errorf("release retry is required") | ||
} | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func (t *GithubVar) validate() error { | ||
if t.RunnerID == "" { | ||
return fmt.Errorf("error: GITHUB_RUN_ID is not set. Please set the GITHUB_RUN_ID environment variable") | ||
} | ||
if t.SafeRepo == "" { | ||
return fmt.Errorf("error: not found repository.full_name in github event") | ||
} | ||
if t.CommentBody == "" { | ||
return fmt.Errorf("error: not found comment.body in github event") | ||
} | ||
if t.IssueOrPRNumber == 0 { | ||
return fmt.Errorf("error: not found issue.number or pull_request.number in github event") | ||
} | ||
return nil | ||
} |
Oops, something went wrong.