-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from Keyrxng/gg
feat: `Hello-world` and template bump
- Loading branch information
Showing
23 changed files
with
599 additions
and
299 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
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 |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
"@octokit/rest": "20.1.1", | ||
"@octokit/webhooks": "13.2.7", | ||
"@sinclair/typebox": "0.32.33", | ||
"@supabase/supabase-js": "2.43.5", | ||
"@ubiquity-dao/ubiquibot-logger": "^1.3.0", | ||
"dotenv": "16.4.5", | ||
"typebox-validators": "0.3.5" | ||
}, | ||
|
@@ -45,6 +45,7 @@ | |
"@eslint/js": "9.5.0", | ||
"@jest/globals": "29.7.0", | ||
"@mswjs/data": "0.16.1", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "20.14.5", | ||
"cspell": "8.9.0", | ||
"eslint": "9.5.0", | ||
|
@@ -79,5 +80,6 @@ | |
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,59 @@ | ||
import { Context } from "../types"; | ||
|
||
/** | ||
* NOTICE: Remove this file or use it as a template for your own plugins. | ||
* | ||
* This encapsulates the logic for a plugin if the only thing it does is say "Hello, world!". | ||
* | ||
* Try it out by running your local kernel worker and running the `yarn worker` command. | ||
* Comment on an issue in a repository where your GitHub App is installed and see the magic happen! | ||
* | ||
* Logger examples are provided to show how to log different types of data. | ||
*/ | ||
export async function helloWorld(context: Context) { | ||
const { | ||
logger, | ||
payload, | ||
octokit, | ||
config: { configurableResponse }, | ||
} = context; | ||
|
||
const sender = payload.comment.user?.login; | ||
const repo = payload.repository.name; | ||
const issueNumber = payload.issue.number; | ||
const owner = payload.repository.owner.login; | ||
const body = payload.comment.body; | ||
|
||
if (!body.match(/hello/i)) { | ||
logger.error(`Invalid use of slash command, use "/hello".`, { body }); | ||
return; | ||
} | ||
|
||
logger.info("Hello, world!"); | ||
logger.debug(`Executing helloWorld:`, { sender, repo, issueNumber, owner }); | ||
|
||
try { | ||
await octokit.issues.createComment({ | ||
owner: payload.repository.owner.login, | ||
repo: payload.repository.name, | ||
issue_number: payload.issue.number, | ||
body: configurableResponse, | ||
}); | ||
} catch (error) { | ||
/** | ||
* logger.fatal should not be used in 9/10 cases. Use logger.error instead. | ||
* | ||
* Below are examples of passing error objects to the logger, only one is needed. | ||
*/ | ||
if (error instanceof Error) { | ||
logger.error(`Error creating comment:`, { error: error, stack: error.stack }); | ||
throw error; | ||
} else { | ||
logger.error(`Error creating comment:`, { err: error, error: new Error() }); | ||
throw error; | ||
} | ||
} | ||
|
||
logger.ok(`Successfully created comment!`); | ||
logger.verbose(`Exiting helloWorld`); | ||
} |
Oops, something went wrong.