-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support to create issue from discord using /issue command
- Loading branch information
1 parent
c5564d5
commit 453b5a4
Showing
4 changed files
with
145 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const { SlashCommandBuilder } = require("discord.js"); | ||
|
||
const issue = new SlashCommandBuilder() | ||
.setName("issue") | ||
.setDescription("Create an issue"); | ||
|
||
module.exports = issue.toJSON(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const { Octokit } = require("@octokit/rest"); | ||
|
||
const createIssue = async ( | ||
title, | ||
description, | ||
label, | ||
owner, | ||
repoName, | ||
authToken, | ||
) => { | ||
try { | ||
const octokit = new Octokit({ auth: authToken }); | ||
const response = await octokit.request( | ||
"POST /repos/{owner}/{repo}/issues", | ||
{ | ||
owner: owner, | ||
repo: repoName, | ||
title: title, | ||
body: description, | ||
labels: label, | ||
}, | ||
); | ||
|
||
return response; | ||
} catch (error) { | ||
console.log("Error: ", error); | ||
} | ||
}; | ||
|
||
module.exports = createIssue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters