mirror of
https://github.com/maciejpedzich/playlist-entry-validator.git
synced 2024-11-28 00:15:48 +01:00
Don't dismiss a review if all entries are valid
This commit is contained in:
parent
1077d2d97e
commit
eae9b4a347
18
bot.ts
18
bot.ts
@ -1,6 +1,8 @@
|
|||||||
import { ApplicationFunction } from 'probot';
|
import { ApplicationFunction } from 'probot';
|
||||||
import getMetaData from 'metadata-scraper';
|
import getMetaData from 'metadata-scraper';
|
||||||
|
|
||||||
|
type ReviewEvent = 'REQUEST_CHANGES' | 'COMMENT' | 'APPROVE';
|
||||||
|
|
||||||
const bot: ApplicationFunction = (app) => {
|
const bot: ApplicationFunction = (app) => {
|
||||||
app.on(
|
app.on(
|
||||||
['pull_request.opened', 'pull_request.synchronize'],
|
['pull_request.opened', 'pull_request.synchronize'],
|
||||||
@ -22,8 +24,6 @@ const bot: ApplicationFunction = (app) => {
|
|||||||
const removePathFromFilename = (filename: string) =>
|
const removePathFromFilename = (filename: string) =>
|
||||||
filename.replace(registryDirectoryPath, '');
|
filename.replace(registryDirectoryPath, '');
|
||||||
|
|
||||||
type ReviewEvent = 'REQUEST_CHANGES' | 'COMMENT' | 'APPROVE';
|
|
||||||
|
|
||||||
const upsertReview = async (
|
const upsertReview = async (
|
||||||
review_id: number | undefined,
|
review_id: number | undefined,
|
||||||
body: string,
|
body: string,
|
||||||
@ -34,6 +34,7 @@ const bot: ApplicationFunction = (app) => {
|
|||||||
...workingRepo,
|
...workingRepo,
|
||||||
pull_number,
|
pull_number,
|
||||||
review_id,
|
review_id,
|
||||||
|
event,
|
||||||
body
|
body
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -161,19 +162,6 @@ const bot: ApplicationFunction = (app) => {
|
|||||||
.join('\n\n');
|
.join('\n\n');
|
||||||
|
|
||||||
await upsertReview(existingReview?.id, reviewBody, reviewEvent);
|
await upsertReview(existingReview?.id, reviewBody, reviewEvent);
|
||||||
|
|
||||||
if (
|
|
||||||
renameRequiredText === '' &&
|
|
||||||
notFoundText === '' &&
|
|
||||||
existingReview?.state === 'CHANGES_REQUESTED'
|
|
||||||
) {
|
|
||||||
await context.octokit.pulls.dismissReview({
|
|
||||||
...workingRepo,
|
|
||||||
pull_number,
|
|
||||||
review_id: existingReview.id,
|
|
||||||
message: 'All new entries can be accepted!'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user