Skip to content

Commit

Permalink
[github-integration] Add werft help command
Browse files Browse the repository at this point in the history
  • Loading branch information
csweichel committed Jun 23, 2021
1 parent a1372f1 commit 4b6a9e2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion plugins/github-integration/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ var (
annotationStatusUpdate = "updateGitHubStatus"

defaultGitHubHost = "github.com"

commandHelp = `You can interact with werft using: ` + "`" + `/werft command <args>` + "`" + `.
Available commands are:
- ` + "`" + `/werft run [annotation=value]` + "`" + ` which starts a new werft job from this context.
You can optionally pass multiple whitespace-separated annotations.
- ` + "`" + `/werft help` + "`" + ` displays this help
`
)

// Config configures this plugin
Expand Down Expand Up @@ -420,8 +427,10 @@ func (p *githubTriggerPlugin) processIssueCommentEvent(ctx context.Context, even
switch cmd {
case "run":
resp, err = p.handleCommandRun(ctx, event, pr, args)
case "help":
resp = commandHelp
default:
err = fmt.Errorf("unknown command: %s", cmd)
err = fmt.Errorf("unknown command: %s\nUse `/werft help` to list the available commands", cmd)
}
if err != nil {
log.WithError(err).Warn("GitHub webhook error")
Expand Down

0 comments on commit 4b6a9e2

Please sign in to comment.