git clone --depth 1 --single-branch https://github.com/jerryc05/GitHubIssueReportBot.git
# If you want to save any file, use
# `git stash -- FILENAME` and then pop it after reset
git fetch --depth 1 &&
git reset --hard FETCH_HEAD
pip install -U -r requirements.txt
- Refer to
schema.sql
for info about theissues
table. - Only the
title
row is REQUIRED. - The
unix_epoch
field (optional) is designed to record when the issue happened. Only set this field when necessary.- It is usually better NOT to set this field since it defaults to the time at insertion.
- DO NOT insert into private row(s), or you will be rejected.
- Example (
shell
):# Minimal insert sqlite3 ./db.db 'insert into issues(title) values("test title");' # Full insert sqlite3 ./db.db 'insert into issues( title,body,labels,assignees,unix_epoch ) values( "Issue title", -- Tip: char(10) represents a "\n" -- "Issue body!"||char(10)||"This is a new line!", "bug"||char(10)||"help wanted", -- Tip: Only the first assignee will be assigned -- -- if you are using GitHub Free -- "gh_username1"||char(10)||"gh_username2", -- Tip: Only set this field when necessary -- 1625097600 );'
- Using libraries will be much more convenient than
shell
.- E.g. Python sqlite3 and sqlite-jdbc.
# FOR USER #
export OWNER=''
export REPO=''
export INSTALL_ID=0 # Copy from settings/installations
# FOR DEVELOPER #
export APP_ID=0
export PRIVATE_PEM_PATH=''
./main.py
DO NOT forget to check for exit status!
# FOR JAVA INTERFACE #
export SCRIPT_PATH="/path/to/bot/main.py"
export SQLITE_PATH="/path/to/bot/db.db"
# FOR USER #
export OWNER=''
export REPO=''
export INSTALL_ID=0 # Copy from settings/installations
# FOR DEVELOPER #
export APP_ID=0
export PRIVATE_PEM_PATH=''
# start normally in any way you want
mvn exec:java ... # Or [java -jar xxx.jar ...]
// Do self check during app start-up is a good idea
IssueReport.selfCheck();
NEW way:
// If you have an exception to report
try {
// balabala
} except (Exception e) {
try (IssueReport ir = new IssueReport(e)) {
ir.appendBody("You can add lines in body here ...")
.appendBody("You can add more lines in body here ...")
// .withMilestone("name_of_milestone") // Add milestone if you wish
.withLabels(List.of("bug", "java")) // Add labels here
// Only the first assignee will be assigned if you are using GitHub free
// .withAssignees(List.of("github_userid_1","github_userid_2"))
// Usually you don't need this unless you want to log another timestamp
.withUnixEpoch(unixEpoch);
// `ir` will be automatically submitted after this try block
}
}
// If you only have a message to report
try (IssueReport ir = new IssueReport("Issue title")) {
ir.appendBody("You can add lines in body here ...")
.appendBody("You can add more lines in body here ...")
// .withMilestone("name_of_milestone") // Add milestone if you wish
.withLabels(List.of("bug", "java")) // Add labels here
// Only the first assignee will be assigned if you are using GitHub free
// .withAssignees(List.of("github_userid_1","github_userid_2"))
// Usually you don't need this unless you want to log another timestamp
.withUnixEpoch(unixEpoch);
// `ir` will be automatically submitted after this try block
}
OLD way:
IssueReport ir;
// If you have an exception to report
try {
// balabala
} except (Exception e) {
ir = new IssueReport(e);
}
// If you only have a message to report
ir = new IssueReport("Issue title");
// Submit this issue
ir.appendBody("You can add lines in body here ...")
.appendBody("You can add more lines in body here ...")
// .withMilestone("name_of_milestone") // Add milestone if you wish
.withLabels(List.of("bug", "java")) // Add labels here
// Only the first assignee will be assigned if you are using GitHub free
// .withAssignees(List.of("github_userid_1","github_userid_2"))
// Usually you don't need this unless you want to log another timestamp
.withUnixEpoch(unixEpoch)
.submit(); // Don't forget to submit