From d2823f6de366f8cf1800548beb0080595a255beb Mon Sep 17 00:00:00 2001 From: ludeeus Date: Fri, 29 Sep 2023 22:24:13 +0000 Subject: [PATCH] prettier --- .devcontainer.json | 2 +- .github/dependabot.yml | 12 ++++++------ .github/workflows/wrangler.yml | 9 ++++----- src/index.ts | 15 ++++++++------- src/plugins/debug.ts | 12 ++++++------ src/utils/extractOwnerRepo.ts | 14 +++++++------- src/utils/filter.ts | 13 +++++++------ src/utils/postDiscordMessage.ts | 20 ++++++++++---------- 8 files changed, 49 insertions(+), 48 deletions(-) diff --git a/.devcontainer.json b/.devcontainer.json index acb08465..987fb712 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -26,4 +26,4 @@ }, "files.trimTrailingWhitespace": true } -} \ No newline at end of file +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b524871a..c20050e2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,13 +1,13 @@ version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: 'github-actions' + directory: '/' schedule: interval: weekly - time: "06:00" - - package-ecosystem: "npm" - directory: "/" + time: '06:00' + - package-ecosystem: 'npm' + directory: '/' schedule: interval: weekly - time: "06:00" + time: '06:00' open-pull-requests-limit: 10 diff --git a/.github/workflows/wrangler.yml b/.github/workflows/wrangler.yml index 85101c6e..3e385189 100644 --- a/.github/workflows/wrangler.yml +++ b/.github/workflows/wrangler.yml @@ -13,8 +13,8 @@ concurrency: cancel-in-progress: true env: - WRANGLER_SEND_METRICS: "false" - WRANGLER_VERSION: "3.10.1" + WRANGLER_SEND_METRICS: 'false' + WRANGLER_VERSION: '3.10.1' jobs: wrangler: @@ -27,7 +27,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18 - cache: "npm" + cache: 'npm' - name: Install run: npm ci @@ -44,7 +44,6 @@ jobs: if: github.event_name != 'push' uses: cloudflare/wrangler-action@2.0.0 with: - apiToken: "pull_request" + apiToken: 'pull_request' wranglerVersion: ${{ env.WRANGLER_VERSION }} command: deploy --dry-run=true - diff --git a/src/index.ts b/src/index.ts index 1adab0e8..00f20cc1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,20 +1,21 @@ import { handleRequest } from './handler' declare global { - const APP_ID: string; - const PRIVATE_KEY: string; - const WEBHOOK_SECRET: string; + const APP_ID: string const DISCORD_WEBHOOK: string - const INSTALLATION_ID: string; + const INSTALLATION_ID: string const ORGANIZATION: string + const PRIVATE_KEY: string + const WEBHOOK_SECRET: string } addEventListener('fetch', (event) => { - if (event.request.method === 'POST' && event.request.cf?.asOrganization === ORGANIZATION) { + if ( + event.request.method === 'POST' && + event.request.cf?.asOrganization === ORGANIZATION + ) { event.respondWith(handleRequest(event.request)) - } else { event.respondWith(new Response(null, { status: 403 })) } - }) diff --git a/src/plugins/debug.ts b/src/plugins/debug.ts index 114adc0e..a1c68b96 100644 --- a/src/plugins/debug.ts +++ b/src/plugins/debug.ts @@ -1,11 +1,11 @@ -import { App } from "octokit"; -import { IssuePullPayload } from "../types"; +import { App } from 'octokit' +import { IssuePullPayload } from '../types' -import { extractOwnerRepo } from "../utils/extractOwnerRepo"; +import { extractOwnerRepo } from '../utils/extractOwnerRepo' export default async (app: App, payload: IssuePullPayload): Promise => { - console.debug("DebugPlugin", { + console.debug('DebugPlugin', { extractOwnerRepo: extractOwnerRepo(payload), - payload: payload - }); + payload: payload, + }) } diff --git a/src/utils/extractOwnerRepo.ts b/src/utils/extractOwnerRepo.ts index dcacead7..3d500ab8 100644 --- a/src/utils/extractOwnerRepo.ts +++ b/src/utils/extractOwnerRepo.ts @@ -1,14 +1,14 @@ -import { IssuePullPayload } from "../types"; +import { IssuePullPayload } from '../types' export interface OwnerRepo { - owner: string; - repo: string; + owner: string + repo: string } -export const extractOwnerRepo = (payload: IssuePullPayload): OwnerRepo => { - const repository = payload.repository.full_name; +export const extractOwnerRepo = (payload: IssuePullPayload): OwnerRepo => { + const repository = payload.repository.full_name return { - owner: repository.split("/")[0], - repo: repository.split("/")[1], + owner: repository.split('/')[0], + repo: repository.split('/')[1], } } diff --git a/src/utils/filter.ts b/src/utils/filter.ts index 061cf7cb..56357059 100644 --- a/src/utils/filter.ts +++ b/src/utils/filter.ts @@ -1,9 +1,10 @@ -import { IssuePullPayload } from "../types"; +import { IssuePullPayload } from '../types' -export const NAME = "Filter"; -export const ADMINS = ["ludeeus"]; - -export const senderIsAdmin = (payload: IssuePullPayload): boolean => ADMINS.includes(payload.sender.login); -export const senderIsBot = (payload: IssuePullPayload): boolean => payload.sender.type !== "User"; +export const NAME = 'Filter' +export const ADMINS = ['ludeeus'] +export const senderIsAdmin = (payload: IssuePullPayload): boolean => + ADMINS.includes(payload.sender.login) +export const senderIsBot = (payload: IssuePullPayload): boolean => + payload.sender.type !== 'User' diff --git a/src/utils/postDiscordMessage.ts b/src/utils/postDiscordMessage.ts index a5940700..97fd3b2c 100644 --- a/src/utils/postDiscordMessage.ts +++ b/src/utils/postDiscordMessage.ts @@ -1,11 +1,11 @@ -export const postDiscordMessage = async (content: Record): Promise => { - await fetch( - DISCORD_WEBHOOK, - { - method: "POST", - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(content) - }) +export const postDiscordMessage = async ( + content: Record, +): Promise => { + await fetch(DISCORD_WEBHOOK, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(content), + }) }