Skip to content
Open
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
47 changes: 47 additions & 0 deletions .github/workflows/bot-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Bot CI

on:
pull_request:
branches:
- main
paths:
- 'packages/bot/**'
- 'package.json'
- 'bun.lock'
- 'tsconfig.json'
- '.github/workflows/bot-ci.yml'

jobs:
validate:
name: Validate Bot Package
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
bun-

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Run Biome check
run: cd packages/bot && bun run check

- name: TypeScript type check
run: cd packages/bot && bun x tsc --noEmit

# Uncomment when tests are added
# - name: Run tests
# run: cd packages/bot && bun test
43 changes: 43 additions & 0 deletions .github/workflows/service-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Service CI

on:
pull_request:
branches:
- main
paths:
- 'packages/service/**'
- 'package.json'
- 'bun.lock'
- 'tsconfig.json'
- '.github/workflows/service-ci.yml'

jobs:
validate:
name: Validate Service Package
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
bun-

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Run Biome check
run: cd packages/service && bun run check

- name: TypeScript type check
run: cd packages/service && bun x tsc --noEmit
6 changes: 3 additions & 3 deletions packages/bot/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Hono } from "hono";
import {
InteractionResponseType,
InteractionType,
verifyKey,
} from "discord-interactions";
import { ADD_COMMAND, DELETE_COMMAND, UPDATE_COMMAND } from "./commands";
import { Hono } from "hono";
import { addLink, deleteLink, updateLink } from "./client";
import { ADD_COMMAND, DELETE_COMMAND, UPDATE_COMMAND } from "./commands";

// interface Env {
// DISCORD_APPLICATION_ID: string;
Expand Down Expand Up @@ -90,7 +90,7 @@ app.post("/", async (c) => {
return sendChannelMessage(
`Shortlink created: https://s.acmcsuf.com/${slug} -> ${url}`,
);
} catch (error: any) {
} catch (error) {
return sendChannelMessage(
`Failed to create shortlink: ${error instanceof Error ? error.message : "Unknown error"}`,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/bot/src/register.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ADD_COMMAND, DELETE_COMMAND } from "./commands";
import dotenv from "dotenv";
import { ADD_COMMAND, DELETE_COMMAND } from "./commands";

/**
* This file is meant to be run from the command line, and is not used by the
Expand Down
Loading