Compare commits

..

4 Commits

4 changed files with 363 additions and 2698 deletions

View File

@@ -7,7 +7,7 @@ import { getPlaylistIdFromUrl } from './getPlaylistIdFromUrl';
type ReviewEvent = 'REQUEST_CHANGES' | 'COMMENT' | 'APPROVE'; type ReviewEvent = 'REQUEST_CHANGES' | 'COMMENT' | 'APPROVE';
const appFn: ApplicationFunction = (app: Probot, { getRouter }) => { const appFn: ApplicationFunction = (app: Probot) => {
app.on( app.on(
['pull_request.opened', 'pull_request.synchronize'], ['pull_request.opened', 'pull_request.synchronize'],
async ({ payload, octokit, log }) => { async ({ payload, octokit, log }) => {
@@ -29,14 +29,14 @@ const appFn: ApplicationFunction = (app: Probot, { getRouter }) => {
body: string body: string
) => { ) => {
if (review_id) { if (review_id) {
await octokit.pulls.updateReview({ await octokit.rest.pulls.updateReview({
...workingRepo, ...workingRepo,
pull_number, pull_number,
review_id, review_id,
body body
}); });
} else { } else {
await octokit.pulls.createReview({ await octokit.rest.pulls.createReview({
...workingRepo, ...workingRepo,
pull_number, pull_number,
event, event,
@@ -47,6 +47,7 @@ const appFn: ApplicationFunction = (app: Probot, { getRouter }) => {
const repoAllowlist = [ const repoAllowlist = [
{ owner: 'mackorone', repo: 'spotify-playlist-archive' }, { owner: 'mackorone', repo: 'spotify-playlist-archive' },
{ owner: 'mackorone', repo: 'spotify-playlist-archive-2' },
{ owner: 'maciejpedzich', repo: 'bot-testing-ground' } { owner: 'maciejpedzich', repo: 'bot-testing-ground' }
]; ];
@@ -59,7 +60,7 @@ const appFn: ApplicationFunction = (app: Probot, { getRouter }) => {
if (!isAllowlistedRepo) return; if (!isAllowlistedRepo) return;
type PRFileArray = Awaited< type PRFileArray = Awaited<
ReturnType<typeof octokit.pulls.listFiles> ReturnType<typeof octokit.rest.pulls.listFiles>
>['data']; >['data'];
const prFiles: PRFileArray = []; const prFiles: PRFileArray = [];
@@ -70,7 +71,7 @@ const appFn: ApplicationFunction = (app: Probot, { getRouter }) => {
while (isLoadingPages) { while (isLoadingPages) {
await setTimeout(timeToRateLimitReset); await setTimeout(timeToRateLimitReset);
const { data, headers } = await octokit.pulls.listFiles({ const { data, headers } = await octokit.rest.pulls.listFiles({
...workingRepo, ...workingRepo,
pull_number, pull_number,
page page
@@ -285,7 +286,7 @@ const appFn: ApplicationFunction = (app: Probot, { getRouter }) => {
.filter(Boolean) .filter(Boolean)
.join('\n\n'); .join('\n\n');
const { data: reviews } = await octokit.pulls.listReviews({ const { data: reviews } = await octokit.rest.pulls.listReviews({
...workingRepo, ...workingRepo,
pull_number pull_number
}); });

View File

@@ -1,4 +1,8 @@
import { run } from 'probot'; import { run } from 'probot';
import appFn from './appFn'; import appFn from './appFn';
run(appFn); run(appFn).then((server) => {
process.on('SIGTERM', async () => {
await server.stop();
});
});

3038
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,7 @@
"homepage": "https://github.com/maciejpedzich/mackorone-playlist-pr-bot#readme", "homepage": "https://github.com/maciejpedzich/mackorone-playlist-pr-bot#readme",
"dependencies": { "dependencies": {
"metadata-scraper": "^0.2.61", "metadata-scraper": "^0.2.61",
"probot": "^13.4.5", "probot": "^14.2.4",
"promise-throttle-all": "^1.1.1" "promise-throttle-all": "^1.1.1"
}, },
"engines": { "engines": {
@@ -27,6 +27,6 @@
"devDependencies": { "devDependencies": {
"@types/node": "^22.15.29", "@types/node": "^22.15.29",
"ts-node-dev": "^2.0.0", "ts-node-dev": "^2.0.0",
"typescript": "^5.8.3" "typescript": "^5.9.3"
} }
} }