Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MI-3583]: Added a message to create a subscription after running pipeline #44

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
24 changes: 24 additions & 0 deletions server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,30 @@ 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)

subs, err := p.GetSubscriptionsByChannel(channelID)
if err != nil {
return err.Error()
}
if len(subs) == 0 {
txt += "###### Currently there are no subscriptions present in this channel\n"
txt += fmt.Sprintf("You can create a subscription for pipeline by running the command `/gitlab subscriptions add %s pipeline`", namespace)
} else {
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
var isPipelineSubscriptionPresent bool
subscriptionFeatures := "pipeline"
for _, sub := range subs {
if sub.Repository == namespace {
subscriptionFeatures = sub.Features + " ," + subscriptionFeatures
if sub.Features == "pipeline" {
isPipelineSubscriptionPresent = true
}
}
}
if !isPipelineSubscriptionPresent {
txt += "###### Currently there are no subscriptions for pipeline present in this channel\n"
txt += fmt.Sprintf("You can create a subscription for pipline by running the command `/gitlab subscriptions add %s %s`", namespace, subscriptionFeatures)
}
}
return txt
}

Expand Down
Loading