Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Sep 29, 2023
1 parent 3ef9d59 commit d2823f6
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
},
"files.trimTrailingWhitespace": true
}
}
}
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 4 additions & 5 deletions .github/workflows/wrangler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -27,7 +27,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
cache: 'npm'

- name: Install
run: npm ci
Expand All @@ -44,7 +44,6 @@ jobs:
if: github.event_name != 'push'
uses: cloudflare/[email protected]
with:
apiToken: "pull_request"
apiToken: 'pull_request'
wranglerVersion: ${{ env.WRANGLER_VERSION }}
command: deploy --dry-run=true

15 changes: 8 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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 }))
}

})
12 changes: 6 additions & 6 deletions src/plugins/debug.ts
Original file line number Diff line number Diff line change
@@ -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<void> => {
console.debug("DebugPlugin", {
console.debug('DebugPlugin', {
extractOwnerRepo: extractOwnerRepo(payload),
payload: payload
});
payload: payload,
})
}
14 changes: 7 additions & 7 deletions src/utils/extractOwnerRepo.ts
Original file line number Diff line number Diff line change
@@ -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],
}
}
13 changes: 7 additions & 6 deletions src/utils/filter.ts
Original file line number Diff line number Diff line change
@@ -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'
20 changes: 10 additions & 10 deletions src/utils/postDiscordMessage.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export const postDiscordMessage = async (content: Record<string, any>): Promise<void> => {
await fetch(
DISCORD_WEBHOOK,
{
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(content)
})
export const postDiscordMessage = async (
content: Record<string, any>,
): Promise<void> => {
await fetch(DISCORD_WEBHOOK, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(content),
})
}

0 comments on commit d2823f6

Please sign in to comment.