Skip to content

Commit 17c2205

Browse files
authored
fix: revert node v20 & upgrade deps (#213)
* Revert "fix: upgrade npm 10.x (#211)" This reverts commit 4a5cccd. * Revert "build: fix deploy error (#209)" This reverts commit 9c480a2. * Revert "build: upgrade node v20 & upgrade deps (#208)" This reverts commit 76601d6.
1 parent 4a5cccd commit 17c2205

File tree

21 files changed

+15774
-6458
lines changed

21 files changed

+15774
-6458
lines changed

.github/workflows/ci.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
name: Lint
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v3
1515
- name: Setup Node.js
16-
uses: actions/setup-node@v4
16+
uses: actions/setup-node@v3
1717
with:
18-
node-version: '20.x'
18+
node-version: '16.x'
1919
- name: Install dependencies
2020
run: npm install
2121
- name: Lint files
@@ -25,11 +25,11 @@ jobs:
2525
strategy:
2626
matrix:
2727
os: [ubuntu-latest]
28-
node: [20.x]
28+
node: [16.x]
2929
runs-on: ${{ matrix.os }}
3030
steps:
31-
- uses: actions/checkout@v4
32-
- uses: actions/setup-node@v4
31+
- uses: actions/checkout@v3
32+
- uses: actions/setup-node@v3
3333
with:
3434
node-version: ${{ matrix.node }}
3535
- name: Install dependencies

package-lock.json

+15,694-6,370
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"dependencies": {
2525
"moment": "^2.29.4",
2626
"moment-timezone": "^0.5.35",
27-
"probot": "^9.15.1",
27+
"probot": "^7.4.0",
2828
"probot-scheduler": "^1.0.3"
2929
},
3030
"devDependencies": {
@@ -33,7 +33,7 @@
3333
"globals": "^13.24.0",
3434
"jest": "^26.1.0",
3535
"lint-staged": "^13.2.1",
36-
"nock": "^13.5.4",
36+
"nock": "^10.0.2",
3737
"yorkie": "^2.0.0"
3838
},
3939
"keywords": [
@@ -55,7 +55,6 @@
5555
"testEnvironment": "node"
5656
},
5757
"engines": {
58-
"node": "20.x",
59-
"npm": "10.x"
58+
"node": "16.x"
6059
}
6160
}

src/plugins/auto-closer/index.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const AUTO_CLOSE_LABEL = "auto closed";
2020
*/
2121
async function hasAutoCloseLabel(context) {
2222
const allLabels = await context.github.paginate(
23-
context.github.issues.listLabelsForRepo.endpoint.merge(context.repo())
23+
context.github.issues.listLabelsForRepo(context.repo()),
24+
res => res.data
2425
);
2526

2627
return allLabels.some(label => label.name === AUTO_CLOSE_LABEL);
@@ -159,9 +160,9 @@ a message to our [mailing list](https://groups.google.com/group/eslint) or
159160
*/
160161
async function closeIssue(context, issueNum, commentText) {
161162
await Promise.all([
162-
context.github.issues.update(context.repo({ issue_number: issueNum, state: "closed" })),
163-
context.github.issues.addLabels(context.repo({ issue_number: issueNum, labels: [AUTO_CLOSE_LABEL] })),
164-
context.github.issues.createComment(context.repo({ issue_number: issueNum, body: commentText }))
163+
context.github.issues.update(context.repo({ number: issueNum, state: "closed" })),
164+
context.github.issues.addLabels(context.repo({ number: issueNum, labels: [AUTO_CLOSE_LABEL] })),
165+
context.github.issues.createComment(context.repo({ number: issueNum, body: commentText }))
165166
]);
166167
}
167168

@@ -173,8 +174,8 @@ async function closeIssue(context, issueNum, commentText) {
173174
*/
174175
function queryIssues(context, searchQuery) {
175176
return context.github.paginate(
176-
context.github.search.issuesAndPullRequests.endpoint.merge({ q: searchQuery, per_page: 100 }),
177-
result => result.data
177+
context.github.search.issues({ q: searchQuery, per_page: 100 }),
178+
result => result.data.items
178179
);
179180
}
180181

src/plugins/check-unit-test/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async function action(context) {
6060
const { payload, github } = context;
6161

6262
if (!isChoreTypePullRequest(payload.pull_request.title)) {
63-
const { data: allFiles } = await github.pulls.listFiles(context.issue());
63+
const { data: allFiles } = await github.pullRequests.listFiles(context.issue());
6464

6565
if (!areUnitTestFilesPresent(allFiles, payload.repository.html_url)) {
6666
await github.issues.createComment(context.issue({

src/plugins/commit-message/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ async function processCommitMessage(context) {
102102
return;
103103
}
104104

105-
const allCommits = await github.pulls.listCommits(context.issue());
105+
const allCommits = await github.pullRequests.listCommits(context.issue());
106106
const messageToCheck = payload.pull_request.title;
107107
const errors = getCommitMessageErrors(messageToCheck);
108108
let description;

src/plugins/issue-archiver/index.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const ARCHIVED_LABEL = "archived due to age";
1414
*/
1515
async function hasArchivedLabel(context) {
1616
const allLabels = await context.github.paginate(
17-
context.github.issues.listLabelsForRepo.endpoint.merge(context.repo())
17+
context.github.issues.listLabelsForRepo(context.repo()),
18+
res => res.data
1819
);
1920

2021
return allLabels.some(label => label.name === ARCHIVED_LABEL);
@@ -48,8 +49,8 @@ function createSearchQuery({ owner, repo }) {
4849
*/
4950
async function archiveIssue(context, issueNum) {
5051
await Promise.all([
51-
context.github.issues.lock(context.repo({ issue_number: issueNum })),
52-
context.github.issues.addLabels(context.repo({ issue_number: issueNum, labels: [ARCHIVED_LABEL] }))
52+
context.github.issues.lock(context.repo({ number: issueNum })),
53+
context.github.issues.addLabels(context.repo({ number: issueNum, labels: [ARCHIVED_LABEL] }))
5354
]);
5455
}
5556

@@ -62,8 +63,8 @@ async function getAllSearchResults(context) {
6263
const searchQuery = createSearchQuery(context.repo());
6364

6465
return context.github.paginate(
65-
context.github.search.issues.endpoint.merge({ q: searchQuery, per_page: 100 }),
66-
result => result.data
66+
context.github.search.issues({ q: searchQuery, per_page: 100 }),
67+
result => result.data.items
6768

6869
/*
6970
* Do not label issues which are already locked.

src/plugins/pr-ready-to-merge/common.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function addPrApprovedLabel(context) {
4545
* @returns {Promise<Object | null>} Promise that fulfills when the action is complete
4646
*/
4747
async function getPullrequestBySha(context, sha) {
48-
const { data: { items } } = await context.github.search.issuesAndPullRequests({
48+
const { data: { items } } = await context.github.search.issues({
4949
q: sha
5050
});
5151

@@ -59,8 +59,8 @@ async function getPullrequestBySha(context, sha) {
5959
* @returns {Promise<Array>} Resolves with commit collection
6060
*/
6161
async function getAllCommitsByPR(context, prId) {
62-
const { data: commits } = await context.github.pulls.getCommits(context.repo({
63-
pull_number: prId
62+
const { data: commits } = await context.github.pullRequests.getCommits(context.repo({
63+
number: prId
6464
}));
6565

6666
return commits;

src/plugins/pr-ready-to-merge/reviewCheck.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const { getPullrequestBySha, labels } = require("./common");
1414
* @returns {Promise<Array>} Resolves with all reviews collection
1515
*/
1616
async function getAllReviewsByPR(context, prId) {
17-
const { data: allReviews } = await context.github.pulls.getReviews(context.repo({
18-
pull_number: prId
17+
const { data: allReviews } = await context.github.pullRequests.getReviews(context.repo({
18+
number: prId
1919
}));
2020

2121
return allReviews;

src/plugins/recurring-issues/index.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,6 @@ Resources:
7777
*/
7878
async function getTeamMembers({ github, organizationName, teamName }) {
7979

80-
/**
81-
* TODO: use getByUsername (`github.users.getById()` has been removed since @octokit/rest v16+)
82-
* Gets the name of a user by their userid
83-
* @param {number} id user id to get the name of
84-
* @returns {Promise<string>} the user's name
85-
*/
86-
function getById(id) {
87-
return github.request(`GET /user/${id}`).then(res => res.data.name);
88-
}
89-
9080
/*
9181
* NOTE: This will fail if the organization contains more than 100 teams. This isn't
9282
* close to being a problem right now, so it hasn't been worth figuring out a good
@@ -103,7 +93,7 @@ async function getTeamMembers({ github, organizationName, teamName }) {
10393

10494
return Promise.all(teamMembers.map(async member => ({
10595
login: member.login,
106-
name: await getById(member.id)
96+
name: await github.users.getById({ id: member.id }).then(res => res.data.name)
10797
})));
10898
}
10999

@@ -176,7 +166,7 @@ async function issueWasClosedMultipleTimes(github, { owner, repo, number }) {
176166
const issueEvents = await github.issues.listEvents({
177167
owner,
178168
repo,
179-
issue_number: number,
169+
number,
180170
per_page: 100
181171
}).then(res => res.data);
182172

src/plugins/release-monitor/index.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ function pluckLatestCommitSha(allCommits) {
3737
*/
3838
function getAllOpenPRs(context) {
3939
return context.github.paginate(
40-
context.github.pulls.list.endpoint.merge(
40+
context.github.pullRequests.list(
4141
context.repo({
4242
state: "open"
4343
})
44-
)
44+
),
45+
res => res.data
4546
);
4647
}
4748

@@ -77,8 +78,8 @@ function createStatusOnPR({ context, state, sha, description, targetUrl }) {
7778
* @private
7879
*/
7980
async function getAllCommitsForPR({ context, pr }) {
80-
const { data: commitList } = await context.github.pulls.listCommits(
81-
context.repo({ pull_number: pr.number })
81+
const { data: commitList } = await context.github.pullRequests.listCommits(
82+
context.repo({ number: pr.number })
8283
);
8384

8485
return commitList;

src/plugins/wip/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async function maybeResolveWipStatusOnPR(context, sha) {
7878
let statusCheckExists = false;
7979

8080
await context.github.paginate(
81-
context.github.repos.getCombinedStatusForRef.endpoint.merge(repoAndRef),
81+
context.github.repos.getCombinedStatusForRef(repoAndRef),
8282
(res, done) => {
8383
for (const status of res.data.statuses) {
8484
if (status.context === "wip") {
@@ -105,8 +105,8 @@ async function maybeResolveWipStatusOnPR(context, sha) {
105105
* @private
106106
*/
107107
async function getAllCommitsForPR({ context, pr }) {
108-
const { data: commitList } = await context.github.pulls.listCommits(
109-
context.repo({ pull_number: pr.number })
108+
const { data: commitList } = await context.github.pullRequests.listCommits(
109+
context.repo({ number: pr.number })
110110
);
111111

112112
return commitList;

tests/plugins/auto-closer/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
// Requirements
1010
//-----------------------------------------------------------------------------
1111

12-
const autoCloser = require("../../../src/plugins/auto-closer/index.js");
12+
const { autoCloser } = require("../../../src/plugins/index");
1313

1414
const nock = require("nock");
1515
const probot = require("probot");
16-
const GitHubApi = require("@octokit/rest").Octokit;
16+
const GitHubApi = require("@octokit/rest");
1717

1818
//-----------------------------------------------------------------------------
1919
// Helpers
@@ -101,8 +101,8 @@ describe("auto-closer", () => {
101101
beforeEach(async () => {
102102
githubNock = nock("https://api.github.com");
103103
bot = new probot.Application({
104-
id: 110,
105-
githubToken: "test",
104+
id: "test",
105+
cert: "test",
106106
cache: {
107107
wrap: () => Promise.resolve({ data: { token: "test" } })
108108
},

tests/plugins/check-unit-test/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"use strict";
22

3-
const checkUnitTest = require("../../../src/plugins/check-unit-test/index.js");
3+
const { checkUnitTest } = require("../../../src/plugins/index");
44
const nock = require("nock");
55
const probot = require("probot");
6-
const GitHubApi = require("@octokit/rest").Octokit;
6+
const GitHubApi = require("@octokit/rest");
77

88
/**
99
* Mocks a given PR on issue existing with specified files

tests/plugins/commit-message/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"use strict";
22

3-
const commitMessage = require("../../../src/plugins/commit-message/index.js");
3+
const { commitMessage } = require("../../../src/plugins/index");
44
const { TAG_LABELS } = require("../../../src/plugins/commit-message/util");
55
const nock = require("nock");
66
const probot = require("probot");
7-
const GitHubApi = require("@octokit/rest").Octokit;
7+
const GitHubApi = require("@octokit/rest");
88

99
/**
1010
* Mocks a given commit on a PR with the specified message
@@ -98,8 +98,8 @@ describe("commit-message", () => {
9898

9999
beforeAll(() => {
100100
bot = new probot.Application({
101-
id: 110,
102-
githubToken: "test",
101+
id: "test",
102+
cert: "test",
103103
cache: {
104104
wrap: () => Promise.resolve({ data: { token: "test" } })
105105
}

tests/plugins/duplicate-comments/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"use strict";
22

3-
const duplicateComments = require("../../../src/plugins/duplicate-comments/index.js");
3+
const { duplicateComments } = require("../../../src/plugins/index");
44
const nock = require("nock");
55
const probot = require("probot");
6-
const GitHubApi = require("@octokit/rest").Octokit;
6+
const GitHubApi = require("@octokit/rest");
77

88
/**
99
* Creates a mock PR with the given comments
@@ -85,8 +85,8 @@ describe("duplicate-comments", () => {
8585

8686
beforeAll(() => {
8787
bot = new probot.Application({
88-
id: 110,
89-
githubToken: "test",
88+
id: "test",
89+
cert: "test",
9090
cache: {
9191
wrap: () => Promise.resolve({ data: { token: "test" } })
9292
}

tests/plugins/issue-archiver/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"use strict";
22

3-
const issueArchiver = require("../../../src/plugins/issue-archiver/index.js");
3+
const { issueArchiver } = require("../../../src/plugins/index");
44

55
const nock = require("nock");
66
const probot = require("probot");
7-
const GitHubApi = require("@octokit/rest").Octokit;
7+
const GitHubApi = require("@octokit/rest");
88

99
describe("issue-archiver", () => {
1010
let bot;
1111

1212
beforeEach(async () => {
1313
bot = new probot.Application({
14-
id: 110,
15-
githubToken: "test",
14+
id: "test",
15+
cert: "test",
1616
cache: {
1717
wrap: () => Promise.resolve({ data: { token: "test" } })
1818
},

tests/plugins/needs-info/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"use strict";
22

3-
const needsInfo = require("../../../src/plugins/needs-info/index.js");
3+
const { needsInfo } = require("../../../src/plugins/index");
44
const nock = require("nock");
55
const probot = require("probot");
6-
const GitHubApi = require("@octokit/rest").Octokit;
6+
const GitHubApi = require("@octokit/rest");
77

88
describe("needs-info", () => {
99
let bot = null;
1010
let issueCommentReq = null;
1111

1212
beforeAll(() => {
1313
bot = new probot.Application({
14-
id: 110,
15-
githubToken: "test",
14+
id: "test",
15+
cert: "test",
1616
cache: {
1717
wrap: () => Promise.resolve({ data: { token: "test" } })
1818
}

0 commit comments

Comments
 (0)