Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ func (p *Plugin) pipelineRunCommand(ctx context.Context, namespace, ref, channel
if err != nil {
return err.Error()
}

var txt string
if pipelineInfo == nil {
txt = "Currently there is no pipeline info"
Expand All @@ -738,6 +739,25 @@ func (p *Plugin) pipelineRunCommand(ctx context.Context, namespace, ref, channel
txt += fmt.Sprintf("**Ref**: %s\n", pipelineInfo.Ref)
txt += fmt.Sprintf("**Triggered By**: %s\n", pipelineInfo.User)
txt += fmt.Sprintf("**Visit pipeline [here](%s)** \n\n", pipelineInfo.WebURL)

foundPipelineSubscription := false
subs, err := p.GetSubscriptionsByChannel(channelID)
if err != nil {
p.client.Log.Warn("Failed to get subscriptions for the channel", "channel_id", channelID, "error", err.Error())
return txt
}

for _, sub := range subs {
if sub.Repository == namespace && sub.Pipeline() {
foundPipelineSubscription = true
break
}
}

if !foundPipelineSubscription {
txt += fmt.Sprintf("\n\n**Note:** This channel is currently not subscribed to pipeline event for `%s`. Run the command below if would you like to create a subscription.\n\n`/gitlab subscriptions add %s pipeline`", namespace, namespace)
}

return txt
}

Expand Down