Skip to content

Commit

Permalink
feat: Upgrade to Node 22 (#214)
Browse files Browse the repository at this point in the history
* fix: Make bot work in Node 22

* feat: Upgrade to Node.js v22

* Update CI script

* Remove nock

* Fix test failures

* Remove octokit/rest

* Fix release-monitor tests
  • Loading branch information
nzakas authored Jan 15, 2025
1 parent 17c2205 commit 3461ecf
Show file tree
Hide file tree
Showing 29 changed files with 7,381 additions and 11,331 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: 22.x
- name: Install dependencies
run: npm install
- name: Lint files
Expand All @@ -25,14 +25,14 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [16.x]
node: [22.x]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test
run: npm test
15,607 changes: 6,501 additions & 9,106 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,17 @@
"*.js": "eslint --fix"
},
"dependencies": {
"moment": "^2.29.4",
"moment-timezone": "^0.5.35",
"probot": "^7.4.0",
"probot-scheduler": "^1.0.3"
"moment": "^2.30.1",
"moment-timezone": "^0.5.46",
"probot": "^13.4.1"
},
"devDependencies": {
"eslint": "^8.55.0",
"eslint-config-eslint": "^9.0.0",
"fetch-mock": "^12.2.0",
"globals": "^13.24.0",
"jest": "^26.1.0",
"jest": "^29.7.0",
"lint-staged": "^13.2.1",
"nock": "^10.0.2",
"yorkie": "^2.0.0"
},
"keywords": [
Expand All @@ -55,6 +54,6 @@
"testEnvironment": "node"
},
"engines": {
"node": "16.x"
"node": "22.x"
}
}
34 changes: 24 additions & 10 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,25 @@

"use strict";

const probot = require("probot");
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------

const { Probot, run } = require("probot");
const plugins = require("./plugins");

//-----------------------------------------------------------------------------
// Type Definitions
//-----------------------------------------------------------------------------

/** @typedef {import("probot").Probot} Probot */
/** @typedef {import("probot").Context<any>} ProbotContext */
/** @typedef {import("probot").ProbotOctokit} ProbotOctokit */

//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------

if (!process.env.SECRET) {
throw new Error("Missing 'SECRET' environment variable");
}
Expand All @@ -21,17 +37,15 @@ if (!process.env.APP_ID) {
}

const port = process.env.PORT || 8000;
const bot = probot.createProbot({
port,
const app = new Probot({
privateKey: process.env.PRIVATE_KEY,
appId: process.env.APP_ID,
secret: process.env.SECRET,
cert: process.env.PRIVATE_KEY,
id: process.env.APP_ID
port
});

const enabledPlugins = new Set([
"addToTriageProject",
"autoCloser",
"commitMessage",
"issueArchiver",
"needsInfo",
"recurringIssues",
"releaseMonitor",
Expand All @@ -41,7 +55,7 @@ const enabledPlugins = new Set([
// load all the enabled plugins from inside plugins folder
Object.keys(plugins)
.filter(pluginId => enabledPlugins.has(pluginId))
.forEach(pluginId => bot.load(plugins[pluginId]));
.forEach(pluginId => app.load(plugins[pluginId]));

// start the server
bot.start();
run(app);
218 changes: 0 additions & 218 deletions src/plugins/auto-closer/index.js

This file was deleted.

Loading

0 comments on commit 3461ecf

Please sign in to comment.