mirror of
https://github.com/sern-handler/automata
synced 2026-06-06 01:16:51 +00:00
chore: initial commit, delete EVERYTHING
This commit is contained in:
45
.gitignore
vendored
45
.gitignore
vendored
@@ -1,45 +0,0 @@
|
||||
.gradle
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
|
||||
/src/main/resources/
|
||||
/.env
|
||||
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@@ -1,8 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
7
.idea/discord.xml
generated
7
.idea/discord.xml
generated
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="PROJECT" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
||||
18
.idea/gradle.xml
generated
18
.idea/gradle.xml
generated
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
13
.idea/misc.xml
generated
13
.idea/misc.xml
generated
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
124
.idea/uiDesigner.xml
generated
124
.idea/uiDesigner.xml
generated
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,2 +1,5 @@
|
||||
# automata
|
||||
A github bot for automating github related stuff
|
||||
|
||||
a javascript rewrite by @SrIzan10
|
||||
ty seren for giving me dev access to the organization :D
|
||||
@@ -1,52 +0,0 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
val jwt_version : String by project
|
||||
val coroutine_version : String by project
|
||||
val gh_version : String by project
|
||||
val arrow_fx_version : String by project
|
||||
val fuel_version : String by project
|
||||
plugins {
|
||||
kotlin("jvm") version "1.7.10"
|
||||
application
|
||||
kotlin("plugin.serialization") version "1.7.10"
|
||||
}
|
||||
|
||||
group = "org.example"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform("io.arrow-kt:arrow-stack:$arrow_fx_version"))
|
||||
implementation("io.ktor:ktor-server-content-negotiation-jvm:2.1.0")
|
||||
implementation("io.ktor:ktor-serialization-gson-jvm:2.1.0")
|
||||
testImplementation(kotlin("test"))
|
||||
|
||||
implementation("io.ktor:ktor-client-core:2.1.0")
|
||||
implementation("io.ktor:ktor-client-cio:2.1.0")
|
||||
implementation("io.ktor:ktor-client-content-negotiation:2.1.0")
|
||||
implementation("io.ktor:ktor-client-json:2.1.0")
|
||||
implementation("io.ktor:ktor-client-serialization:2.0.3")
|
||||
implementation("io.ktor:ktor-serialization-kotlinx-json:2.1.0")
|
||||
// Use JSON serialization
|
||||
implementation("io.ktor:ktor-server-core-jvm:2.0.3")
|
||||
implementation("io.ktor:ktor-server-netty-jvm:2.0.3")
|
||||
implementation("com.auth0:java-jwt:$jwt_version")
|
||||
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version")
|
||||
implementation("io.github.cdimascio:dotenv-kotlin:6.3.1")
|
||||
implementation("io.arrow-kt:arrow-core")
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("MainKt")
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
kotlin.code.style=official
|
||||
jwt_version=4.0.0
|
||||
coroutine_version= 1.6.4
|
||||
gh_version=1.307
|
||||
arrow_fx_version=1.0.1
|
||||
fuel_version=4.6.4
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
234
gradlew
vendored
234
gradlew
vendored
@@ -1,234 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
gradlew.bat
vendored
89
gradlew.bat
vendored
@@ -1,89 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
rootProject.name = "sern-automata"
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
import io.github.cdimascio.dotenv.dotenv
|
||||
import io.ktor.serialization.kotlinx.json.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.engine.*
|
||||
import io.ktor.server.netty.*
|
||||
import io.ktor.server.plugins.contentnegotiation.*
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.serialization.json.Json
|
||||
import structures.HttpProvider
|
||||
import structures.api.account.OrgAccount
|
||||
import structures.api.account.TokenData
|
||||
import structures.wrapped.Base
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
object Globals {
|
||||
val eventEmitter = EventEmitter<Base>()
|
||||
val serializer = Json {
|
||||
ignoreUnknownKeys = true
|
||||
prettyPrint = true
|
||||
explicitNulls = false
|
||||
}
|
||||
}
|
||||
|
||||
class Client : CoroutineScope {
|
||||
val api = HttpProvider(this)
|
||||
private var parentJob = Job()
|
||||
lateinit var application : structures.api.application.Application
|
||||
lateinit var orgAccount: OrgAccount
|
||||
lateinit var tokenData : TokenData
|
||||
override val coroutineContext: CoroutineContext
|
||||
get() = Dispatchers.Default + parentJob
|
||||
init {
|
||||
dotenv {
|
||||
systemProperties = true
|
||||
}
|
||||
}
|
||||
inline fun <reified T : Base> on(
|
||||
eventName: String,
|
||||
crossinline fn: suspend (T) -> Unit
|
||||
) {
|
||||
launch {
|
||||
Globals.eventEmitter.events.collect {
|
||||
when (eventName) {
|
||||
"pull_request" -> {
|
||||
fn(it as T)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
suspend fun loginAsync() {
|
||||
coroutineScope {
|
||||
withContext(Dispatchers.Default) {
|
||||
application = api.loginIntoApplicationAsync().await()
|
||||
orgAccount = api.loginIntoOrgAsync().await()
|
||||
tokenData = api.getInstallationTokenAsync(orgAccount).await()
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This should start last in order to prevent blocking of thread and listeners
|
||||
*/
|
||||
fun startWebhookListener() {
|
||||
embeddedServer(
|
||||
Netty,
|
||||
port = 8000,
|
||||
host = "localhost",
|
||||
parentCoroutineContext = coroutineContext
|
||||
) {
|
||||
configureRouting(this@Client)
|
||||
install(ContentNegotiation) {
|
||||
json(Globals.serializer)
|
||||
}
|
||||
}.start(wait = true).also { println("Started server") }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.asSharedFlow
|
||||
import structures.api.Response
|
||||
import structures.wrapped.Base
|
||||
|
||||
class EventEmitter<T : Base> {
|
||||
private val _events = MutableSharedFlow<T>() // private mutable shared flow
|
||||
val events = _events.asSharedFlow() // publicly exposed as read-only shared flow
|
||||
|
||||
suspend fun produceEvent(event: T) {
|
||||
_events.emit(event) // suspends until all subscribers receive it
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
import HashUtils.verifySignature
|
||||
import arrow.core.Either
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.request.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
import io.ktor.util.pipeline.*
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import javax.crypto.Mac
|
||||
import javax.crypto.spec.SecretKeySpec
|
||||
import kotlin.experimental.xor
|
||||
|
||||
|
||||
fun Application.configureRouting(client: Client) {
|
||||
routing {
|
||||
|
||||
pullRequests(client)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun Routing.pullRequests(client: Client) {
|
||||
post("/pulls") {
|
||||
val secret = call.request.headers["X-Hub-Signature-256"]!!
|
||||
val event = call.request.headers["X-Github-Event"]!!
|
||||
val respText = call.receiveText()
|
||||
when(val resp = verifySignature(secret, respText)) {
|
||||
is Either.Left -> {
|
||||
launch(Dispatchers.Default) {
|
||||
when(event) {
|
||||
"pull_request" -> {
|
||||
Globals.eventEmitter.produceEvent(
|
||||
structures.wrapped.PullRequestsManager(client,
|
||||
Globals.serializer.decodeFromString(resp.value)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
call.respond(HttpStatusCode.OK)
|
||||
}.join()
|
||||
}
|
||||
is Either.Right -> resp.value
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
object HashUtils {
|
||||
private fun ByteArray.toHex(): String = joinToString(separator = "") { eachByte -> "%02x".format(eachByte) }
|
||||
|
||||
//https://security.stackexchange.com/questions/239054/timing-attacks-in-password-hash-comparisons
|
||||
fun secureCompare(secret : String, hash: String) : Boolean {
|
||||
val digesta = secret.toByteArray(); val digestb = hash.toByteArray()
|
||||
|
||||
if (digesta.size and digestb.size == 0) return false
|
||||
var difference = 0
|
||||
for (i in digesta.indices) difference = difference.or(digesta[i].xor(digestb[i]).toInt())
|
||||
return difference == 0
|
||||
}
|
||||
/**
|
||||
* Supported algorithms on Android:
|
||||
*
|
||||
* Algorithm Supported API Levels
|
||||
* MD5 1+
|
||||
* SHA-1 1+
|
||||
* SHA-224 1-8,22+
|
||||
* SHA-256 1+
|
||||
* SHA-384 1+
|
||||
* SHA-512 1+
|
||||
*/
|
||||
fun sha256(body: String): String {
|
||||
val key = System.getProperty("WEBHOOK_TOKEN")
|
||||
val hasher: Mac = Mac.getInstance("HmacSHA256")
|
||||
hasher.init(SecretKeySpec(key.toByteArray(), "HmacSHA256"))
|
||||
|
||||
val hash: ByteArray = hasher.doFinal(body.toByteArray())
|
||||
return "sha256=${hash.toHex()}"
|
||||
}
|
||||
|
||||
suspend inline fun PipelineContext<Unit, ApplicationCall>.verifySignature(secret: String, resp: String) : Either<String, Unit> {
|
||||
if(secureCompare(secret, sha256(resp))) {
|
||||
return Either.Left(resp)
|
||||
}
|
||||
return Either.Right(call.respond(HttpStatusCode.Unauthorized, "Nice try"))
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
import structures.api.application.PullRequestAction
|
||||
import structures.options.PullRequestCreateOptions
|
||||
import structures.wrapped.PullRequestsManager
|
||||
|
||||
fun main() = runBlocking {
|
||||
val sernClient = Client()
|
||||
sernClient.loginAsync()
|
||||
|
||||
sernClient.on<PullRequestsManager>("pull_request") { pr_event ->
|
||||
when(pr_event.action) {
|
||||
PullRequestAction.Opened -> {
|
||||
println("new pull request opened")
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
sernClient.startWebhookListener()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
package structures
|
||||
import Client
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.call.*
|
||||
import io.ktor.client.engine.cio.*
|
||||
import io.ktor.client.plugins.contentnegotiation.*
|
||||
import io.ktor.client.request.*
|
||||
import io.ktor.client.statement.*
|
||||
import io.ktor.http.*
|
||||
import io.ktor.serialization.kotlinx.json.*
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.serialization.encodeToString
|
||||
import structures.api.Response
|
||||
import structures.api.account.OrgAccount
|
||||
import structures.api.account.TokenData
|
||||
import structures.api.application.Application
|
||||
import structures.options.PostOptions
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
class HttpProvider(private val client: Client) : CoroutineScope {
|
||||
val httpClient = HttpClient(CIO) {
|
||||
install(ContentNegotiation) {
|
||||
json(Globals.serializer)
|
||||
}
|
||||
}
|
||||
enum class ApiType {
|
||||
Rest,
|
||||
App
|
||||
}
|
||||
val orgName = "sern-handler"
|
||||
val baseLink = "https://api.github.com"
|
||||
|
||||
fun authHeader(type: ApiType): Pair<String, String> {
|
||||
return HttpHeaders.Authorization to when(type) {
|
||||
ApiType.App -> "Bearer ${JWTProvider.jwt}"
|
||||
ApiType.Rest -> "Bearer ${client.tokenData.token}"
|
||||
}
|
||||
}
|
||||
val contentTypeHeader = HttpHeaders.Accept to "application/vnd.github+json"
|
||||
inline fun <reified T : Response, reified V: PostOptions> postAsync(path: String, body: V) : Deferred<T> {
|
||||
return async {
|
||||
httpClient.post("$baseLink/$path") {
|
||||
headers {
|
||||
append(HttpHeaders.ContentType, "application/json")
|
||||
append(contentTypeHeader)
|
||||
append(authHeader(ApiType.Rest))
|
||||
}
|
||||
setBody(body)
|
||||
}.body()
|
||||
}
|
||||
}
|
||||
|
||||
fun loginIntoApplicationAsync() : Deferred<Application> {
|
||||
return async {
|
||||
httpClient.request("$baseLink/app") {
|
||||
headers {
|
||||
append(contentTypeHeader)
|
||||
append(authHeader(ApiType.App))
|
||||
}
|
||||
}.body()
|
||||
}
|
||||
}
|
||||
fun loginIntoOrgAsync(): Deferred<OrgAccount> {
|
||||
return async {
|
||||
// GHAppInstallation
|
||||
httpClient.request("$baseLink/orgs/$orgName/installation") {
|
||||
headers {
|
||||
append(contentTypeHeader)
|
||||
append(authHeader(ApiType.App))
|
||||
}
|
||||
}.body()
|
||||
}
|
||||
}
|
||||
|
||||
fun getInstallationTokenAsync(orgAccount: OrgAccount): Deferred<TokenData> {
|
||||
return async {
|
||||
httpClient.post("$baseLink/app/installations/${orgAccount.id}/access_tokens") {
|
||||
headers {
|
||||
append(contentTypeHeader)
|
||||
append(authHeader(ApiType.App))
|
||||
}
|
||||
}.body()
|
||||
}
|
||||
}
|
||||
override val coroutineContext: CoroutineContext
|
||||
get() = Dispatchers.Default + Job()
|
||||
}
|
||||
|
||||
fun HeadersBuilder.append(name: Pair<String, String>) {
|
||||
append(name.first, name.second)
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package structures
|
||||
|
||||
import com.auth0.jwt.JWT
|
||||
import com.auth0.jwt.algorithms.Algorithm
|
||||
import java.security.KeyFactory
|
||||
import java.security.interfaces.RSAPrivateKey
|
||||
import java.security.spec.PKCS8EncodedKeySpec
|
||||
import java.time.Instant
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Thank you hub4j/githubapi
|
||||
*/
|
||||
object JWTProvider {
|
||||
private val validUntil = Instant.MIN
|
||||
private val privateKey: RSAPrivateKey? =
|
||||
javaClass.getResourceAsStream("/private_key.pem")
|
||||
?.bufferedReader()
|
||||
?.useLines { br ->
|
||||
val privateKey = br.filter { str ->
|
||||
str != "-----BEGIN PRIVATE KEY-----" && str != "-----END PRIVATE KEY-----"
|
||||
}
|
||||
val seq = privateKey.joinToString("")
|
||||
val encoded = Base64.getDecoder().decode(seq)
|
||||
val kf = KeyFactory.getInstance("RSA")
|
||||
val keySpec = PKCS8EncodedKeySpec(encoded)
|
||||
(kf.generatePrivate(keySpec) as RSAPrivateKey)
|
||||
}
|
||||
val jwt : String = JWT.create()
|
||||
.withIssuer(System.getProperty("APP_ID"))
|
||||
.withIssuedAt(Instant.now().minusMillis(6_000))
|
||||
.withExpiresAt(Instant.now().plusMillis(600000))
|
||||
.sign(Algorithm.RSA256(privateKey))
|
||||
|
||||
fun isNotValid(): Boolean {
|
||||
return Instant.now().isAfter(validUntil)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package structures.api
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
data class AutoMerge(
|
||||
val commit_message: String?,
|
||||
val commit_title: String?,
|
||||
val enabled_by: EnabledBy,
|
||||
val merge_method: String
|
||||
) : Response()
|
||||
@@ -1,11 +0,0 @@
|
||||
package structures.api
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Base(
|
||||
|
||||
val label: String,
|
||||
val ref: String,
|
||||
val repo: Repo,
|
||||
val sha: String,
|
||||
val user: User
|
||||
)
|
||||
@@ -1,5 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Comments(
|
||||
val href: String
|
||||
)
|
||||
@@ -1,5 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Commits(
|
||||
val href: String
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class EnabledBy(
|
||||
val avatar_url: String,
|
||||
val events_url: String,
|
||||
val followers_url: String,
|
||||
val following_url: String,
|
||||
val gists_url: String,
|
||||
val gravatar_id: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val login: String,
|
||||
val node_id: String,
|
||||
val organizations_url: String,
|
||||
val received_events_url: String,
|
||||
val repos_url: String,
|
||||
val site_admin: Boolean,
|
||||
val starred_url: String,
|
||||
val subscriptions_url: String,
|
||||
val type: String,
|
||||
val url: String
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Head(
|
||||
val label: String,
|
||||
val ref: String,
|
||||
val repo: Repo,
|
||||
val sha: String,
|
||||
val user: User
|
||||
)
|
||||
@@ -1,5 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Html(
|
||||
val href: String
|
||||
)
|
||||
@@ -1,5 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Issue(
|
||||
val href: String
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Label(
|
||||
val color: String,
|
||||
val default: Boolean,
|
||||
val description: String,
|
||||
val id: Long,
|
||||
val name: String,
|
||||
val node_id: String,
|
||||
val url: String
|
||||
)
|
||||
@@ -1,12 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Links(
|
||||
val comments: Comments,
|
||||
val commits: Commits,
|
||||
val html: Html,
|
||||
val issue: Issue,
|
||||
val review_comment: ReviewComment,
|
||||
val review_comments: ReviewComments,
|
||||
val self: Self,
|
||||
val statuses: Statuses
|
||||
)
|
||||
@@ -1,13 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Milestone(
|
||||
val creator: User,
|
||||
val description: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val labels_url: String,
|
||||
val node_id: String,
|
||||
val number: Int,
|
||||
val title: String,
|
||||
val url: String
|
||||
)
|
||||
@@ -1,16 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Organization(
|
||||
val avatar_url: String,
|
||||
val description: String,
|
||||
val events_url: String,
|
||||
val hooks_url: String,
|
||||
val id: Int,
|
||||
val issues_url: String,
|
||||
val login: String,
|
||||
val members_url: String,
|
||||
val node_id: String,
|
||||
val public_members_url: String,
|
||||
val repos_url: String,
|
||||
val url: String
|
||||
)
|
||||
@@ -1,59 +0,0 @@
|
||||
package structures.api
|
||||
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
data class PullRequest(
|
||||
val _links: Links,
|
||||
val active_lock_reason: String?,
|
||||
val additions: Int,
|
||||
val assignee: User?,
|
||||
val assignees: List<User>,
|
||||
val author_association: String,
|
||||
val auto_merge: AutoMerge?,
|
||||
val base: Base,
|
||||
val body: String?,
|
||||
val changed_files: Int,
|
||||
val closed_at: String?,
|
||||
val comments: Int,
|
||||
val comments_url: String,
|
||||
val commits: Int,
|
||||
val commits_url: String,
|
||||
val created_at: String,
|
||||
val deletions: Int,
|
||||
val diff_url: String,
|
||||
val draft: Boolean,
|
||||
val head: Head,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val issue_url: String,
|
||||
val labels: List<Label>,
|
||||
val locked: Boolean,
|
||||
val maintainer_can_modify: Boolean,
|
||||
val merge_commit_sha: String?,
|
||||
val mergeable: Boolean?,
|
||||
val mergeable_state: String,
|
||||
val merged: Boolean,
|
||||
val merged_at: String?,
|
||||
val merged_by: MergedBy?,
|
||||
val milestone: Milestone?,
|
||||
val node_id: String,
|
||||
val number: Int,
|
||||
val patch_url: String,
|
||||
val rebaseable: Boolean?,
|
||||
val requested_reviewers: List<RequestedReviewer>,
|
||||
val requested_teams: List<Team>,
|
||||
val review_comment_url: String,
|
||||
val review_comments: Int,
|
||||
val review_comments_url: String,
|
||||
val state: String,
|
||||
val statuses_url: String,
|
||||
val title: String,
|
||||
val updated_at: String,
|
||||
val url: String,
|
||||
val user: User
|
||||
) : Response()
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
data class MergedBy(
|
||||
val login : String
|
||||
)
|
||||
@@ -1,14 +0,0 @@
|
||||
package structures.api
|
||||
|
||||
import structures.api.application.PullRequestAction
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
data class PullRequests(
|
||||
val action: PullRequestAction,
|
||||
val label: Label,
|
||||
val number: Int,
|
||||
val organization: Organization,
|
||||
val pull_request: PullRequest,
|
||||
val repository: Repository,
|
||||
val sender: Sender
|
||||
) : Response()
|
||||
@@ -1,93 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Repo(
|
||||
val allow_auto_merge: Boolean?,
|
||||
val allow_forking: Boolean,
|
||||
val allow_merge_commit: Boolean?,
|
||||
val allow_rebase_merge: Boolean?,
|
||||
val allow_squash_merge: Boolean?,
|
||||
val allow_update_branch: Boolean?,
|
||||
val archive_url: String,
|
||||
val archived: Boolean,
|
||||
val assignees_url: String,
|
||||
val blobs_url: String,
|
||||
val branches_url: String,
|
||||
val clone_url: String,
|
||||
val collaborators_url: String,
|
||||
val comments_url: String,
|
||||
val commits_url: String,
|
||||
val compare_url: String,
|
||||
val contents_url: String,
|
||||
val contributors_url: String,
|
||||
val created_at: String,
|
||||
val default_branch: String,
|
||||
val delete_branch_on_merge: Boolean?,
|
||||
val deployments_url: String,
|
||||
val description: String,
|
||||
val disabled: Boolean,
|
||||
val downloads_url: String,
|
||||
val events_url: String,
|
||||
val fork: Boolean,
|
||||
val forks: Int,
|
||||
val forks_count: Int,
|
||||
val forks_url: String,
|
||||
val full_name: String,
|
||||
val git_commits_url: String,
|
||||
val git_refs_url: String,
|
||||
val git_tags_url: String,
|
||||
val git_url: String,
|
||||
val has_downloads: Boolean,
|
||||
val has_issues: Boolean,
|
||||
val has_pages: Boolean,
|
||||
val has_projects: Boolean,
|
||||
val has_wiki: Boolean,
|
||||
val homepage: String?,
|
||||
val hooks_url: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val is_template: Boolean,
|
||||
val issue_comment_url: String,
|
||||
val issue_events_url: String,
|
||||
val issues_url: String,
|
||||
val keys_url: String,
|
||||
val labels_url: String,
|
||||
val language: String?,
|
||||
val languages_url: String,
|
||||
val license: String?,
|
||||
val merge_commit_message: String?,
|
||||
val merge_commit_title: String?,
|
||||
val merges_url: String,
|
||||
val milestones_url: String,
|
||||
val mirror_url: String?,
|
||||
val name: String,
|
||||
val node_id: String,
|
||||
val notifications_url: String,
|
||||
val open_issues: Int,
|
||||
val open_issues_count: Int,
|
||||
val owner: User,
|
||||
val private: Boolean,
|
||||
val pulls_url: String,
|
||||
val pushed_at: String,
|
||||
val releases_url: String,
|
||||
val size: Int,
|
||||
val squash_merge_commit_message: String?,
|
||||
val squash_merge_commit_title: String?,
|
||||
val ssh_url: String,
|
||||
val stargazers_count: Int,
|
||||
val stargazers_url: String,
|
||||
val statuses_url: String,
|
||||
val subscribers_url: String,
|
||||
val subscription_url: String,
|
||||
val svn_url: String,
|
||||
val tags_url: String,
|
||||
val teams_url: String,
|
||||
val topics: List<String>,
|
||||
val trees_url: String,
|
||||
val updated_at: String,
|
||||
val url: String,
|
||||
val use_squash_pr_title_as_default: Boolean?,
|
||||
val visibility: String,
|
||||
val watchers: Int,
|
||||
val watchers_count: Int,
|
||||
val web_commit_signoff_required: Boolean
|
||||
)
|
||||
@@ -1,83 +0,0 @@
|
||||
package structures.api
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Repository(
|
||||
val allow_forking: Boolean,
|
||||
val archive_url: String,
|
||||
val archived: Boolean,
|
||||
val assignees_url: String,
|
||||
val blobs_url: String,
|
||||
val branches_url: String,
|
||||
val clone_url: String,
|
||||
val collaborators_url: String,
|
||||
val comments_url: String,
|
||||
val commits_url: String,
|
||||
val compare_url: String,
|
||||
val contents_url: String,
|
||||
val contributors_url: String,
|
||||
val created_at: String,
|
||||
val default_branch: String,
|
||||
val deployments_url: String,
|
||||
val description: String,
|
||||
val disabled: Boolean,
|
||||
val downloads_url: String,
|
||||
val events_url: String,
|
||||
val fork: Boolean,
|
||||
val forks: Int,
|
||||
val forks_count: Int,
|
||||
val forks_url: String,
|
||||
val full_name: String,
|
||||
val git_commits_url: String,
|
||||
val git_refs_url: String,
|
||||
val git_tags_url: String,
|
||||
val git_url: String,
|
||||
val has_downloads: Boolean,
|
||||
val has_issues: Boolean,
|
||||
val has_pages: Boolean,
|
||||
val has_projects: Boolean,
|
||||
val has_wiki: Boolean,
|
||||
val homepage: String,
|
||||
val hooks_url: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val is_template: Boolean,
|
||||
val issue_comment_url: String,
|
||||
val issue_events_url: String,
|
||||
val issues_url: String,
|
||||
val keys_url: String,
|
||||
val labels_url: String,
|
||||
val language: String,
|
||||
val languages_url: String,
|
||||
val license: String?,
|
||||
val merges_url: String,
|
||||
val milestones_url: String,
|
||||
val mirror_url: String?,
|
||||
val name: String,
|
||||
val node_id: String,
|
||||
val notifications_url: String,
|
||||
val open_issues: Int,
|
||||
val open_issues_count: Int,
|
||||
val owner: User,
|
||||
val private: Boolean,
|
||||
val pulls_url: String,
|
||||
val pushed_at: String,
|
||||
val releases_url: String,
|
||||
val size: Int,
|
||||
val ssh_url: String,
|
||||
val stargazers_count: Int,
|
||||
val stargazers_url: String,
|
||||
val statuses_url: String,
|
||||
val subscribers_url: String,
|
||||
val subscription_url: String,
|
||||
val svn_url: String,
|
||||
val tags_url: String,
|
||||
val teams_url: String,
|
||||
val topics: List<String>,
|
||||
val trees_url: String,
|
||||
val updated_at: String,
|
||||
val url: String,
|
||||
val visibility: String,
|
||||
val watchers: Int,
|
||||
val watchers_count: Int,
|
||||
val web_commit_signoff_required: Boolean
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class RequestedReviewer(
|
||||
val avatar_url: String,
|
||||
val events_url: String,
|
||||
val followers_url: String,
|
||||
val following_url: String,
|
||||
val gists_url: String,
|
||||
val gravatar_id: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val login: String,
|
||||
val node_id: String,
|
||||
val organizations_url: String,
|
||||
val received_events_url: String,
|
||||
val repos_url: String,
|
||||
val site_admin: Boolean,
|
||||
val starred_url: String,
|
||||
val subscriptions_url: String,
|
||||
val type: String,
|
||||
val url: String
|
||||
)
|
||||
@@ -1,6 +0,0 @@
|
||||
package structures.api
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
sealed class Response
|
||||
@@ -1,5 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class ReviewComment(
|
||||
val href: String
|
||||
)
|
||||
@@ -1,5 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class ReviewComments(
|
||||
val href: String
|
||||
)
|
||||
@@ -1,5 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Self(
|
||||
val href: String
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Sender(
|
||||
val avatar_url: String,
|
||||
val events_url: String,
|
||||
val followers_url: String,
|
||||
val following_url: String,
|
||||
val gists_url: String,
|
||||
val gravatar_id: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val login: String,
|
||||
val node_id: String,
|
||||
val organizations_url: String,
|
||||
val received_events_url: String,
|
||||
val repos_url: String,
|
||||
val site_admin: Boolean,
|
||||
val starred_url: String,
|
||||
val subscriptions_url: String,
|
||||
val type: String,
|
||||
val url: String
|
||||
)
|
||||
@@ -1,5 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Statuses(
|
||||
val href: String
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Team(
|
||||
val description: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val members_url: String,
|
||||
val name: String,
|
||||
val node_id: String,
|
||||
val permission: String,
|
||||
val privacy: String,
|
||||
val repositories_url: String,
|
||||
val slug: String,
|
||||
val url: String
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
package structures.api
|
||||
@kotlinx.serialization.Serializable
|
||||
data class User(
|
||||
val avatar_url: String,
|
||||
val events_url: String,
|
||||
val followers_url: String,
|
||||
val following_url: String,
|
||||
val gists_url: String,
|
||||
val gravatar_id: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val login: String,
|
||||
val node_id: String,
|
||||
val organizations_url: String,
|
||||
val received_events_url: String,
|
||||
val repos_url: String,
|
||||
val site_admin: Boolean,
|
||||
val starred_url: String,
|
||||
val subscriptions_url: String,
|
||||
val type: String,
|
||||
val url: String
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
package structures.api.account
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Account(
|
||||
val avatar_url: String,
|
||||
val events_url: String,
|
||||
val followers_url: String,
|
||||
val following_url: String,
|
||||
val gists_url: String,
|
||||
val gravatar_id: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val login: String,
|
||||
val node_id: String,
|
||||
val organizations_url: String,
|
||||
val received_events_url: String,
|
||||
val repos_url: String,
|
||||
val site_admin: Boolean,
|
||||
val starred_url: String,
|
||||
val subscriptions_url: String,
|
||||
val type: String,
|
||||
val url: String
|
||||
)
|
||||
@@ -1,23 +0,0 @@
|
||||
package structures.api.account
|
||||
@kotlinx.serialization.Serializable
|
||||
data class OrgAccount(
|
||||
val access_tokens_url: String,
|
||||
val account: Account,
|
||||
val app_id: Int,
|
||||
val app_slug: String,
|
||||
val created_at: String,
|
||||
val events: List<String>,
|
||||
val has_multiple_single_files: Boolean,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val permissions: structures.api.application.Permissions,
|
||||
val repositories_url: String,
|
||||
val repository_selection: String,
|
||||
val single_file_name: String?,
|
||||
val single_file_paths: List<String>,
|
||||
val suspended_at: String?,
|
||||
val suspended_by: String?,
|
||||
val target_id: Int,
|
||||
val target_type: String,
|
||||
val updated_at: String
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
package structures.api.account
|
||||
|
||||
import structures.api.application.Permissions
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
data class TokenData(
|
||||
val expires_at: String,
|
||||
val permissions: Permissions,
|
||||
val repository_selection: String,
|
||||
val token: String
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
package structures.api.application
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Application(
|
||||
val created_at: String,
|
||||
val description: String,
|
||||
val events: List<String>,
|
||||
val installations_count : Int,
|
||||
val external_url: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val name: String,
|
||||
val node_id: String,
|
||||
val owner: Owner,
|
||||
val permissions: Permissions,
|
||||
val slug: String,
|
||||
val updated_at: String
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
package structures.api.application
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Owner(
|
||||
val avatar_url: String,
|
||||
val events_url: String,
|
||||
val followers_url: String,
|
||||
val following_url: String,
|
||||
val gists_url: String,
|
||||
val gravatar_id: String,
|
||||
val html_url: String,
|
||||
val id: Int,
|
||||
val login: String,
|
||||
val node_id: String,
|
||||
val organizations_url: String,
|
||||
val received_events_url: String,
|
||||
val repos_url: String,
|
||||
val site_admin: Boolean,
|
||||
val starred_url: String,
|
||||
val subscriptions_url: String,
|
||||
val type: String,
|
||||
val url: String
|
||||
)
|
||||
@@ -1,12 +0,0 @@
|
||||
package structures.api.application
|
||||
@kotlinx.serialization.Serializable
|
||||
data class Permissions(
|
||||
val actions : String,
|
||||
val checks : String,
|
||||
val issues: String,
|
||||
val metadata: String,
|
||||
val organization_events : String,
|
||||
val organization_plan : String,
|
||||
val pull_requests : String,
|
||||
val repository_projects : String,
|
||||
)
|
||||
@@ -1,53 +0,0 @@
|
||||
package structures.api.application
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
enum class PullRequestAction {
|
||||
@SerialName("assigned")
|
||||
Assigned,
|
||||
@SerialName("auto_merge_disabled")
|
||||
AutoMergeDisabled,
|
||||
/*
|
||||
if the action is closed and the merged key is false,
|
||||
the pull request was closed with unmerged commits. If the action is closed and the merged key is true, the pull request was merged.
|
||||
*/
|
||||
@SerialName("closed")
|
||||
Closed,
|
||||
@SerialName("converted_to_draft")
|
||||
ConvertedToDraft,
|
||||
@SerialName("edited")
|
||||
Edited,
|
||||
@SerialName("labeled")
|
||||
Labeled,
|
||||
@SerialName("locked")
|
||||
Locked,
|
||||
@SerialName("opened")
|
||||
Opened,
|
||||
@SerialName("ready_for_review")
|
||||
ReadyForReview,
|
||||
@SerialName("reopened")
|
||||
Reopened,
|
||||
@SerialName("review_request_removed")
|
||||
ReviewRequestRemoved,
|
||||
@SerialName("review_requested")
|
||||
ReviewRequested,
|
||||
|
||||
/**
|
||||
* Triggered when a pull request's head branch is updated.
|
||||
* For example, when the head branch is updated from the base branch,
|
||||
* when new commits are pushed to the head branch, or when the base branch is changed.
|
||||
*/
|
||||
@SerialName("synchronize")
|
||||
Sync,
|
||||
@SerialName("unassigned")
|
||||
Unassigned,
|
||||
@SerialName("unlabeled")
|
||||
Unlabeled,
|
||||
@SerialName("unlocked")
|
||||
Unlocked;
|
||||
|
||||
override fun toString(): String {
|
||||
return name
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package structures.options
|
||||
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
sealed class PostOptions
|
||||
@@ -1,11 +0,0 @@
|
||||
package structures.options
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
data class PullRequestCreateOptions(
|
||||
val title: String,
|
||||
val body: String,
|
||||
val head: String,
|
||||
val base: String,
|
||||
val draft: Boolean? = null,
|
||||
val maintainer_can_modify : Boolean? = null
|
||||
) : PostOptions()
|
||||
@@ -1,5 +0,0 @@
|
||||
package structures.wrapped
|
||||
|
||||
import Client
|
||||
|
||||
open class Base(val client: Client)
|
||||
@@ -1,26 +0,0 @@
|
||||
package structures.wrapped
|
||||
|
||||
import Client
|
||||
import kotlinx.coroutines.Deferred
|
||||
import structures.api.PullRequest
|
||||
import structures.options.PullRequestCreateOptions
|
||||
import structures.api.PullRequests
|
||||
|
||||
|
||||
|
||||
class PullRequestsManager(
|
||||
client: Client,
|
||||
private val prs: PullRequests
|
||||
) : Base(client) {
|
||||
val action = prs.action
|
||||
val head = prs.pull_request.head
|
||||
val base = prs.pull_request.base
|
||||
val currentRepository = Repository(client, prs.repository)
|
||||
|
||||
fun create(
|
||||
repoName: String,
|
||||
options: PullRequestCreateOptions
|
||||
): Deferred<PullRequest> {
|
||||
return client.api.postAsync("repos/${client.api.orgName}/${repoName}/pulls", options)
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package structures.wrapped
|
||||
|
||||
import Client
|
||||
import structures.api.Repository
|
||||
|
||||
class Repository(
|
||||
client: Client,
|
||||
repository: Repository
|
||||
) : Base(client) {
|
||||
val name = repository.name
|
||||
val fullName = repository.full_name
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user