-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
49 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ | |
}, | ||
"files.trimTrailingWhitespace": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected] | ||
with: | ||
apiToken: "pull_request" | ||
apiToken: 'pull_request' | ||
wranglerVersion: ${{ env.WRANGLER_VERSION }} | ||
command: deploy --dry-run=true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 })) | ||
} | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
}) | ||
} |