Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix: update probot to esm #11

Merged
merged 5 commits into from
Apr 29, 2024
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
17 changes: 9 additions & 8 deletions bot/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const axios = require("axios");
const human = require("humanparser");
const licensesAvail = require("./public/assets/data/licenses.json");
const yaml = require("js-yaml");
const { MongoClient } = require("mongodb");
import axios from "axios";
import human from "humanparser";
import licensesAvail from "./public/assets/data/licenses.json" assert { type: "json" };
import yaml from "js-yaml";
import { MongoClient } from "mongodb";
import { nanoid } from "nanoid";

function checkEnvVariable(varName) {
Expand All @@ -16,19 +16,19 @@ checkEnvVariable("MONGODB_DB_NAME");

// sourcery skip: use-object-destructuring
const MONGODB_URI = process.env.MONGODB_URI;
const MONGODB_DB = process.env.MONGODB_DB;
const MONGODB_DB_NAME = process.env.MONGODB_DB_NAME;

const client = new MongoClient(MONGODB_URI, {});

/**
* This is the main entrypoint to your Probot app
* @param {import('probot').Probot} app
*/
module.exports = async (app) => {
export default async (app) => {
// Connect to the MongoDB database
await client.connect();

const db = client.db(MONGODB_DB);
const db = client.db(MONGODB_DB_NAME);
const testCollection = db.collection("test");

await testCollection.insertOne({
Expand Down Expand Up @@ -63,6 +63,7 @@ module.exports = async (app) => {
identifier,
owner,
repo,
open: true,
timestamp: new Date(),
});

Expand Down
3 changes: 2 additions & 1 deletion bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"js-yaml": "^4.1.0",
"mongodb": "^6.5.0",
"nanoid": "^5.0.7",
"probot": "^12.2.4"
"probot": "13.2.0"
},
"devDependencies": {
"autoprefixer": "^10.4.19",
Expand All @@ -37,6 +37,7 @@
"engines": {
"node": ">= 18"
},
"type": "module",
"jest": {
"testEnvironment": "node"
}
Expand Down
Loading