Avoid sending "0 new commits" webhook
Signed-off-by: Till Faelligen <tfaelligen@gmail.com>
This commit is contained in:
parent
8d081950e6
commit
1f47ccfacd
7 changed files with 28 additions and 0 deletions
|
@ -83,6 +83,10 @@ func getDingtalkForkPayload(p *api.ForkPayload) (*DingtalkPayload, error) {
|
|||
}
|
||||
|
||||
func getDingtalkPushPayload(p *api.PushPayload) (*DingtalkPayload, error) {
|
||||
if len(p.Commits) == 0 {
|
||||
return nil, fmt.Errorf("no commits in payload")
|
||||
}
|
||||
|
||||
var (
|
||||
branchName = git.RefEndName(p.Ref)
|
||||
commitDesc string
|
||||
|
|
|
@ -177,6 +177,10 @@ func getDiscordForkPayload(p *api.ForkPayload, meta *DiscordMeta) (*DiscordPaylo
|
|||
}
|
||||
|
||||
func getDiscordPushPayload(p *api.PushPayload, meta *DiscordMeta) (*DiscordPayload, error) {
|
||||
if len(p.Commits) == 0 {
|
||||
return nil, fmt.Errorf("no commits in payload")
|
||||
}
|
||||
|
||||
var (
|
||||
branchName = git.RefEndName(p.Ref)
|
||||
commitDesc string
|
||||
|
|
|
@ -66,6 +66,10 @@ func getFeishuForkPayload(p *api.ForkPayload) (*FeishuPayload, error) {
|
|||
}
|
||||
|
||||
func getFeishuPushPayload(p *api.PushPayload) (*FeishuPayload, error) {
|
||||
if len(p.Commits) == 0 {
|
||||
return nil, fmt.Errorf("no commits in payload")
|
||||
}
|
||||
|
||||
var (
|
||||
branchName = git.RefEndName(p.Ref)
|
||||
commitDesc string
|
||||
|
|
|
@ -145,6 +145,10 @@ func getMatrixReleasePayload(p *api.ReleasePayload, matrix *MatrixMeta) (*Matrix
|
|||
}
|
||||
|
||||
func getMatrixPushPayload(p *api.PushPayload, matrix *MatrixMeta) (*MatrixPayloadUnsafe, error) {
|
||||
if len(p.Commits) == 0 {
|
||||
return nil, fmt.Errorf("no commits in payload")
|
||||
}
|
||||
|
||||
var commitDesc string
|
||||
|
||||
if len(p.Commits) == 1 {
|
||||
|
|
|
@ -196,6 +196,10 @@ func getMSTeamsForkPayload(p *api.ForkPayload) (*MSTeamsPayload, error) {
|
|||
}
|
||||
|
||||
func getMSTeamsPushPayload(p *api.PushPayload) (*MSTeamsPayload, error) {
|
||||
if len(p.Commits) == 0 {
|
||||
return nil, fmt.Errorf("no commits in payload")
|
||||
}
|
||||
|
||||
var (
|
||||
branchName = git.RefEndName(p.Ref)
|
||||
commitDesc string
|
||||
|
|
|
@ -189,6 +189,10 @@ func getSlackReleasePayload(p *api.ReleasePayload, slack *SlackMeta) (*SlackPayl
|
|||
}
|
||||
|
||||
func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, error) {
|
||||
if len(p.Commits) == 0 {
|
||||
return nil, fmt.Errorf("no commits in payload")
|
||||
}
|
||||
|
||||
// n new commits
|
||||
var (
|
||||
commitDesc string
|
||||
|
|
|
@ -86,6 +86,10 @@ func getTelegramForkPayload(p *api.ForkPayload) (*TelegramPayload, error) {
|
|||
}
|
||||
|
||||
func getTelegramPushPayload(p *api.PushPayload) (*TelegramPayload, error) {
|
||||
if len(p.Commits) == 0 {
|
||||
return nil, fmt.Errorf("no commits in payload")
|
||||
}
|
||||
|
||||
var (
|
||||
branchName = git.RefEndName(p.Ref)
|
||||
commitDesc string
|
||||
|
|
Loading…
Add table
Reference in a new issue