Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .github/workflows/claude-code-review.yml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/claude.yml

This file was deleted.

12 changes: 11 additions & 1 deletion .github/workflows/match.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ on:
schedule:
# 매주 월요일 UTC 00:00 (KST 09:00)
- cron: "0 0 * * 1"
workflow_dispatch: # 수동 실행 가능
workflow_dispatch:
inputs:
role:
description: "매칭할 역할 (비워두면 전체 실행)"
required: false
type: choice
options:
- ""
- coffee
- coffee-ui

jobs:
match:
Expand All @@ -27,6 +36,7 @@ jobs:
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
DISCORD_SERVER_ID: ${{ vars.DISCORD_SERVER_ID }}
FORCE_RUN: ${{ github.event_name == 'workflow_dispatch' && 'true' || '' }}
MATCH_ROLE: ${{ inputs.role }}
run: bun run match

- name: Format generated files
Expand Down
17 changes: 16 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,28 @@ function getEnvOrThrow(key: string): string {
async function main() {
const botToken = getEnvOrThrow("DISCORD_BOT_TOKEN");
const forceRun = process.env.FORCE_RUN === "true";
const matchRole = process.env.MATCH_ROLE;

console.log("☕ 커피챗 매칭을 시작합니다...\n");
if (forceRun) {
console.log("⚡ 수동 실행: 스케줄 체크를 건너뜁니다.\n");
}

for (const role of roles) {
const targetRoles = matchRole
? roles.filter((r) => r.name === matchRole)
: roles;

if (matchRole && targetRoles.length === 0) {
throw new Error(
`역할 "${matchRole}"을(를) 찾을 수 없습니다. 사용 가능한 역할: ${roles.map((r) => r.name).join(", ")}`,
);
}

if (matchRole) {
console.log(`🎯 "${matchRole}" 역할만 매칭합니다.\n`);
}

for (const role of targetRoles) {
console.log(`--- [${role.displayName}] 역할 처리 중 ---`);

// 스케줄 체크 (수동 실행 시 건너뜀)
Expand Down
7 changes: 5 additions & 2 deletions worker/scripts/register-commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { COFFEE_COMMAND } from "../src/commands.ts";

const wranglerConfig = await import("../wrangler.jsonc");
const wranglerText = await Bun.file(
new URL("../wrangler.jsonc", import.meta.url),
).text();
const wranglerConfig = JSON.parse(wranglerText.replace(/\/\/.*$/gm, ""));
const devVars = await Bun.file(new URL("../.dev.vars", import.meta.url)).text();

const APPLICATION_ID =
Expand All @@ -9,7 +12,7 @@ const APPLICATION_ID =

const BOT_TOKEN =
process.env.DISCORD_BOT_TOKEN ??
devVars.match(/^DISCORD_BOT_TOKEN=(.+)$/m)?.[1];
devVars.match(/^\s*DISCORD_BOT_TOKEN=(.+)$/m)?.[1]?.trim();

if (!APPLICATION_ID || !BOT_TOKEN) {
console.error(
Expand Down
Loading