Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.acme

import com.github.rvesse.airline.annotations.Arguments
import com.github.rvesse.airline.annotations.Cli
import com.github.rvesse.airline.annotations.Command
import io.quarkiverse.githubapp.command.airline.AbstractHelpCommand
import java.io.IOException
import org.kohsuke.github.GHEventPayload

// TODO: make sure you adjust the name as @bot is an actual GitHub user
@Cli(
name = "@bot",
commands = [MyGitHubBot.SayHello::class, MyGitHubBot.Help::class],
description = "A friendly bot",
)
class MyGitHubBot {

interface Commands {
@Throws(IOException::class)
fun run(issueCommentPayload: GHEventPayload.IssueComment)
}

@Command(name = "say-hello", description = "Says hello")
class SayHello : Commands {

@Arguments var arguments: MutableList<String> = arrayListOf()

@Throws(IOException::class)
override fun run(issueCommentPayload: GHEventPayload.IssueComment) {
issueCommentPayload.issue.comment(":wave: Hello " + arguments.joinToString(" "))
}
}

@Command(name = "help", description = "Displays help")
class Help : AbstractHelpCommand(), Commands {
@Throws(IOException::class)
override fun run(issueCommentPayload: GHEventPayload.IssueComment) {
super.run(issueCommentPayload)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.quarkiverse.githubapp.it.app;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language;
import io.quarkus.devtools.commands.CreateProject.CreateProjectKey;
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest;

public class CodestartKotlinTest {
@RegisterExtension
public static QuarkusCodestartTest codestartKotlinTest = QuarkusCodestartTest.builder()
.languages(Language.KOTLIN)
.setupStandaloneExtensionTest("io.quarkiverse.githubapp:quarkus-github-app")
.putData(CreateProjectKey.PROJECT_NAME, "My GitHub App")
.putData(CreateProjectKey.PROJECT_DESCRIPTION, "My GitHub App description")
.build();

@Test
void testContent() throws Throwable {
codestartKotlinTest.checkGeneratedSource("org.acme.MyGitHubApp");
codestartKotlinTest.assertThatGeneratedFile(Language.KOTLIN, "pom.xml").exists();
codestartKotlinTest.assertThatGeneratedFileMatchSnapshot(Language.KOTLIN, "README.md");
}

@Test
void buildAllProjects() throws Throwable {
codestartKotlinTest.buildAllProjects();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# My GitHub App

> My GitHub App description

This repository contains a GitHub App powered by [Quarkus GitHub App](https://github.com/quarkiverse/quarkus-github-app).

Have a look at the [documentation](https://quarkiverse.github.io/quarkiverse-docs/quarkus-github-app/dev/index.html) to get started.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package ilove.quark.us

import java.io.IOException
import org.kohsuke.github.GHEventPayload
import io.quarkiverse.githubapp.event.Issue

open class MyGitHubApp {

@Throws(IOException::class)
fun onOpen(@Issue.Opened issuePayload: GHEventPayload.Issue) {
issuePayload.issue.comment(":wave: Hello from my GitHub App")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.quarkiverse.githubapp.it.command.airline;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language;
import io.quarkus.devtools.commands.CreateProject.CreateProjectKey;
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest;

public class CodestartKotlinTest {
@RegisterExtension
public static QuarkusCodestartTest codestartKotlinTest = QuarkusCodestartTest.builder()
.languages(Language.KOTLIN)
.setupStandaloneExtensionTest("io.quarkiverse.githubapp:quarkus-github-app-command-airline")
.putData(CreateProjectKey.PROJECT_NAME, "My GitHub Bot")
.putData(CreateProjectKey.PROJECT_DESCRIPTION, "My GitHub Bot description")
.build();

@Test
void testContent() throws Throwable {
codestartKotlinTest.checkGeneratedSource("org.acme.MyGitHubBot");
codestartKotlinTest.assertThatGeneratedFile(Language.KOTLIN, "pom.xml").exists();
codestartKotlinTest.assertThatGeneratedFileMatchSnapshot(Language.KOTLIN, "README.md");
}

@Test
void buildAllProjects() throws Throwable {
codestartKotlinTest.buildAllProjects();

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package ilove.quark.us

import com.github.rvesse.airline.annotations.Arguments
import com.github.rvesse.airline.annotations.Cli
import com.github.rvesse.airline.annotations.Command
import io.quarkiverse.githubapp.command.airline.AbstractHelpCommand
import java.io.IOException
import org.kohsuke.github.GHEventPayload

// TODO: make sure you adjust the name as @bot is an actual GitHub user
@Cli(
name = "@bot",
commands = [MyGitHubBot.SayHello::class, MyGitHubBot.Help::class],
description = "A friendly bot",
)
class MyGitHubBot {

interface Commands {
@Throws(IOException::class)
fun run(issueCommentPayload: GHEventPayload.IssueComment)
}

@Command(name = "say-hello", description = "Says hello")
class SayHello : Commands {

@Arguments var arguments: MutableList<String> = arrayListOf()

@Throws(IOException::class)
override fun run(issueCommentPayload: GHEventPayload.IssueComment) {
issueCommentPayload.issue.comment(":wave: Hello " + arguments.joinToString(" "))
}
}

@Command(name = "help", description = "Displays help")
class Help : AbstractHelpCommand(), Commands {
@Throws(IOException::class)
override fun run(issueCommentPayload: GHEventPayload.IssueComment) {
super.run(issueCommentPayload)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.acme

import java.io.IOException
import org.kohsuke.github.GHEventPayload
import io.quarkiverse.githubapp.event.Issue

open class MyGitHubApp {

@Throws(IOException::class)
fun onOpen(@Issue.Opened issuePayload: GHEventPayload.Issue) {
issuePayload.issue.comment(":wave: Hello from my GitHub App")
}
}
Loading