From 783b28bb10e37556f96388f34104cee039e715d1 Mon Sep 17 00:00:00 2001 From: NiXTheDev <105677206+NiXTheDev@users.noreply.github.com> Date: Sun, 11 Jan 2026 09:25:42 +0300 Subject: [PATCH 1/3] new: update workflows for better checks upon push/pr --- .github/workflows/deno.yml | 45 ----------------- .github/workflows/pr-checks.yml | 76 +++++++++++++++++++++++++++++ .github/workflows/push-checks.yml | 80 +++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/deno.yml create mode 100644 .github/workflows/pr-checks.yml create mode 100644 .github/workflows/push-checks.yml diff --git a/.github/workflows/deno.yml b/.github/workflows/deno.yml deleted file mode 100644 index 6a1f0dc..0000000 --- a/.github/workflows/deno.yml +++ /dev/null @@ -1,45 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow will install Deno then run `deno lint` and `deno test`. -# For more information see: https://github.com/denoland/setup-deno - -name: Deno - -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Setup repo - uses: actions/checkout@v4 - - - name: Setup Deno - uses: denoland/setup-deno@v2 - # uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 # v1.1.2 - with: - deno-version: v2.x - - - name: Create testdb files - run: mkdir db/test_db/ - - # Uncomment this step to verify the use of 'deno fmt' on each commit. - - name: Verify formatting - run: deno fmt --check - - - name: Run linter - run: deno lint - - - name: Run tests - run: deno test -A diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..99b2865 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,76 @@ +name: PR Checks + +on: + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + - uses: actions/cache@v4 + with: + path: ~/.cache/deno + key: deno-v2-${{ hashFiles('deno.json', 'deno.lock') }} + restore-keys: deno-v2- + - name: Run linter + run: deno lint + + format: + name: Format Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + - uses: actions/cache@v4 + with: + path: ~/.cache/deno + key: deno-v2-${{ hashFiles('deno.json', 'deno.lock') }} + restore-keys: deno-v2- + - name: Check format + run: deno fmt --check + + typecheck: + name: Type Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + - uses: actions/cache@v4 + with: + path: ~/.cache/deno + key: deno-v2-${{ hashFiles('deno.json', 'deno.lock') }} + restore-keys: deno-v2- + - name: Run type check + run: deno check ./main.ts ./handlers/ ./models/ ./utils/ + + test: + name: Tests + runs-on: ubuntu-latest + needs: [lint, format, typecheck] + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + - uses: actions/cache@v4 + with: + path: ~/.cache/deno + key: deno-v2-${{ hashFiles('deno.json', 'deno.lock') }} + restore-keys: deno-v2- + - name: Create test db directory + run: mkdir -p db/test_db + - name: Run tests + run: deno test --no-check --allow-write --allow-read --allow-net --allow-env ./tests/* diff --git a/.github/workflows/push-checks.yml b/.github/workflows/push-checks.yml new file mode 100644 index 0000000..7a09967 --- /dev/null +++ b/.github/workflows/push-checks.yml @@ -0,0 +1,80 @@ +name: Push Checks + +on: + push: + branches: [main] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + - uses: actions/cache@v4 + with: + path: ~/.cache/deno + key: deno-v2-${{ hashFiles('deno.json', 'deno.lock') }} + restore-keys: deno-v2- + - name: Run linter + run: deno lint + + format: + name: Format Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + - uses: actions/cache@v4 + with: + path: ~/.cache/deno + key: deno-v2-${{ hashFiles('deno.json', 'deno.lock') }} + restore-keys: deno-v2- + - name: Check format + run: deno fmt --check + + typecheck: + name: Type Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + - uses: actions/cache@v4 + with: + path: ~/.cache/deno + key: deno-v2-${{ hashFiles('deno.json', 'deno.lock') }} + restore-keys: deno-v2- + - name: Run type check + run: deno check ./main.ts ./handlers/ ./models/ ./utils/ + + test: + name: Tests + runs-on: ubuntu-latest + needs: [lint, format, typecheck] + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + - uses: actions/cache@v4 + with: + path: ~/.cache/deno + key: deno-v2-${{ hashFiles('deno.json', 'deno.lock') }} + restore-keys: deno-v2- + - name: Create test db directory + run: mkdir -p db/test_db + - name: Run tests + run: deno test --no-check --allow-write --allow-read --allow-net --allow-env ./tests/* From a7106858aa146f5509dc63dcc1acc06086d6fa05 Mon Sep 17 00:00:00 2001 From: NiXTheDev <105677206+NiXTheDev@users.noreply.github.com> Date: Mon, 12 Jan 2026 02:35:47 +0300 Subject: [PATCH 2/3] fix: type error in setcustom404image --- handlers/register.ts | 11 +---------- handlers/set_custom_404_image.ts | 4 +++- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/handlers/register.ts b/handlers/register.ts index ffe0aa4..86ca94b 100644 --- a/handlers/register.ts +++ b/handlers/register.ts @@ -71,17 +71,8 @@ export async function register(conversation: Conversation, ctx: Context) { "skip-custom-404", ]); - if (custom404Ctx.callbackQuery.data === "set-custom-404") { - await custom404Ctx.editMessageText("Setting up custom 404 image..."); - await conversation.select("set_custom_404_image"); - } else { - await custom404Ctx.editMessageText( - "Skipped. You can set a custom 404 image anytime from Settings.", - ); - } - await ctx.reply( - `Welcome ${user.username}! You have been successfully registered. Would you like to start by recording an entry?`, + `Welcome ${user.username}! You have been successfully registered. You can set a custom 404 image anytime from Settings. Would you like to start by recording an entry?`, { reply_markup: new InlineKeyboard().text("New Entry", "new-entry") }, ); } diff --git a/handlers/set_custom_404_image.ts b/handlers/set_custom_404_image.ts index 67185cd..8f28985 100644 --- a/handlers/set_custom_404_image.ts +++ b/handlers/set_custom_404_image.ts @@ -80,7 +80,9 @@ export async function set_custom_404_image( } const realPath = await Deno.realPath(filePath); - await selfieResponse.body.pipeTo(file.writable); + if (selfieResponse.body) { + await selfieResponse.body.pipeTo(file.writable); + } console.log("Custom 404 image saved to:", realPath); settings!.custom404ImagePath = realPath; From dc175a79fbfefa66eeb8a4999e4d2a4fa112c52a Mon Sep 17 00:00:00 2001 From: NiXTheDev <105677206+NiXTheDev@users.noreply.github.com> Date: Mon, 12 Jan 2026 02:39:00 +0300 Subject: [PATCH 3/3] deno: lint --- handlers/register.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/handlers/register.ts b/handlers/register.ts index 86ca94b..bca990a 100644 --- a/handlers/register.ts +++ b/handlers/register.ts @@ -59,20 +59,7 @@ export async function register(conversation: Conversation, ctx: Context) { await ctx.editMessageText( `Before we finish, would you like to set a custom 404 image? This image will be shown when viewing entries without a selfie.`, { - reply_markup: new InlineKeyboard().text("Yes", "set-custom-404").text( - "No", - "skip-custom-404", - ), + reply_markup: new InlineKeyboard().text("New Entry", "new-entry"), }, ); - - const custom404Ctx = await conversation.waitForCallbackQuery([ - "set-custom-404", - "skip-custom-404", - ]); - - await ctx.reply( - `Welcome ${user.username}! You have been successfully registered. You can set a custom 404 image anytime from Settings. Would you like to start by recording an entry?`, - { reply_markup: new InlineKeyboard().text("New Entry", "new-entry") }, - ); }