mirror of
https://github.com/maciejpedzich/playlist-entry-validator.git
synced 2024-11-28 00:15:48 +01:00
Don't close a pull request approval
This commit is contained in:
parent
da5b67a642
commit
cdbbbd6403
9
bot.ts
9
bot.ts
@ -22,10 +22,12 @@ 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,
|
||||||
event: 'REQUEST_CHANGES' | 'COMMENT'
|
event: ReviewEvent
|
||||||
) => {
|
) => {
|
||||||
if (review_id) {
|
if (review_id) {
|
||||||
await context.octokit.pulls.updateReview({
|
await context.octokit.pulls.updateReview({
|
||||||
@ -114,7 +116,7 @@ const bot: ApplicationFunction = (app) => {
|
|||||||
let renameRequiredText = '';
|
let renameRequiredText = '';
|
||||||
let notFoundText = '';
|
let notFoundText = '';
|
||||||
let successText = `🎉 @${workingRepo.owner} can merge your pull request! 🎉`;
|
let successText = `🎉 @${workingRepo.owner} can merge your pull request! 🎉`;
|
||||||
let reviewEvent: 'REQUEST_CHANGES' | 'COMMENT' = 'COMMENT';
|
let reviewEvent: ReviewEvent = 'APPROVE';
|
||||||
|
|
||||||
if (validEntries.length > 0) {
|
if (validEntries.length > 0) {
|
||||||
const playlistLinks = validEntries
|
const playlistLinks = validEntries
|
||||||
@ -163,7 +165,8 @@ const bot: ApplicationFunction = (app) => {
|
|||||||
if (
|
if (
|
||||||
renameRequiredText === '' &&
|
renameRequiredText === '' &&
|
||||||
notFoundText === '' &&
|
notFoundText === '' &&
|
||||||
existingReview?.id
|
existingReview?.id &&
|
||||||
|
existingReview?.state !== 'APPROVED'
|
||||||
) {
|
) {
|
||||||
await context.octokit.pulls.dismissReview({
|
await context.octokit.pulls.dismissReview({
|
||||||
...workingRepo,
|
...workingRepo,
|
||||||
|
Loading…
Reference in New Issue
Block a user