Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
<artifactId>quarkus-github-app</artifactId>
<version>${quarkus-github-app.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.githubapp</groupId>
<artifactId>quarkus-github-app-command-airline</artifactId>
<version>${quarkus-github-app.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.expressly</groupId>
<artifactId>expressly</artifactId>
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/dev/langchain4j/automation/SayHelloCli.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package dev.langchain4j.automation;

import com.github.rvesse.airline.annotations.Cli;
import com.github.rvesse.airline.annotations.Command;
import org.kohsuke.github.GHEventPayload;
import org.kohsuke.github.GHUser;

import java.io.IOException;

@Cli(name = "@langchain4j-github-bot", commands = { SayHelloCli.SayHello.class })
public class SayHelloCli {

interface Commands {

void run(GHEventPayload.IssueComment issueCommentPayload) throws IOException;
}

@Command(name = "sayHello")
static class SayHello implements Commands {

@Override
public void run(GHEventPayload.IssueComment issueCommentPayload) throws IOException {
// TODO check permissions
GHUser sender = issueCommentPayload.getSender();
Comment on lines +23 to +24
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can automatically check permissions with annotations: https://docs.quarkiverse.io/quarkus-github-app/dev/commands.html#permissions

if (sender != null && sender.getLogin() != null) {
issueCommentPayload.getIssue().comment("Hello, @" + sender.getLogin());
} else {
issueCommentPayload.getIssue().comment("Hello stranger!");
}
}
}
}
Loading