Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 init #2

Open
wants to merge 73 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
664a31c
chore: init
Keyrxng Aug 30, 2024
6023f85
chore: attempts at MTProto auth > failed > moving on
Keyrxng Sep 1, 2024
58ba05e
chore: repo structure, remove unused
Keyrxng Sep 1, 2024
0673806
feat: callback proxy
Keyrxng Sep 1, 2024
cd59b43
chore: supabase
Keyrxng Sep 2, 2024
0bea908
chore: use callbacks, error logging and env
Keyrxng Sep 2, 2024
19fc70c
chore: getDeepVal util and close workroom on issues.closed
Keyrxng Sep 2, 2024
1846d98
chore: supa chats and closed on issues.closed
Keyrxng Sep 2, 2024
61f1da8
chore: supa chats and closed on issues.closed
Keyrxng Sep 2, 2024
bd321d6
chore: use numeric status response
Keyrxng Sep 2, 2024
e212e2b
chore: reopen chatroom on issues.reopen
Keyrxng Sep 2, 2024
2b46d55
chore: fix bot_admins schema, use workroom vs chatroom names
Keyrxng Sep 2, 2024
bf8dee4
fix: proxy usage, event support for labeled/close/reopen with storage
Keyrxng Sep 2, 2024
c6e7af5
chore: test
Keyrxng Sep 3, 2024
a94a2e3
chore: workflow functions
Keyrxng Sep 3, 2024
36124fa
chore: typeguards and error helpers
Keyrxng Sep 3, 2024
43e13ab
chore: proxy types and new env vars
Keyrxng Sep 3, 2024
d266dfd
chore: repo dispatch approach
Keyrxng Sep 3, 2024
1c23980
chore: remove need to specify workflow function
Keyrxng Sep 3, 2024
fdb01f2
chore: deleting files
Keyrxng Sep 3, 2024
96990a5
chore: remove server post and host env
Keyrxng Sep 3, 2024
ec8dca5
chore: add octokit for app auth
Keyrxng Sep 4, 2024
db9dcb0
chore: test
Keyrxng Sep 4, 2024
8986d67
chore: typebox debug
Keyrxng Sep 4, 2024
3293d36
chore: use process.env for workflow
Keyrxng Sep 4, 2024
3f8c1da
chore: use dotenv
Keyrxng Sep 4, 2024
1368fe1
chore: build separate env
Keyrxng Sep 4, 2024
75de906
chore: test
Keyrxng Sep 4, 2024
a2decc8
chore: reduce to 10 env items
Keyrxng Sep 4, 2024
98d3b8d
chore:add connect event
Keyrxng Sep 4, 2024
0eef0d1
chore: move connect to before api invoke
Keyrxng Sep 4, 2024
97b8cff
chore: correct connect in init fn
Keyrxng Sep 4, 2024
995bdda
chore: use messages.createChat
Keyrxng Sep 4, 2024
3e0bc58
chore: revert to channels.createChannell
Keyrxng Sep 4, 2024
4239cfd
Merge pull request #1 from ubq-testing/workflows
Keyrxng Sep 4, 2024
21176eb
chore: squashed Workflows
Keyrxng Sep 8, 2024
5f5f109
chore: squashed workflows
Keyrxng Sep 11, 2024
8c2b267
Squashed commit of the following:
Keyrxng Sep 12, 2024
0286fd5
chore: remove bad squash, alias type for Update
Keyrxng Sep 12, 2024
e760536
chore: fix typeguards
Keyrxng Sep 12, 2024
d785f56
chore: fix getDeepValue generic
Keyrxng Sep 12, 2024
44aee9f
chore: comments and tighten typeguards
Keyrxng Sep 12, 2024
a99acb0
refactor: env configuration
Keyrxng Sep 12, 2024
1092868
chore: update storage adapters
Keyrxng Sep 13, 2024
0ebd2c4
chore: organize commands
Keyrxng Sep 13, 2024
c564bca
chore: refactor env schema, replace all console with Logs
Keyrxng Sep 13, 2024
414f19c
chore: env setup helper
Keyrxng Sep 13, 2024
00d9d42
feat: repo secret saving, guided env setup
Keyrxng Sep 13, 2024
3eb532e
chore: mention repo admin requirement
Keyrxng Sep 13, 2024
45afc7b
chore: fixing up the env setup
Keyrxng Sep 13, 2024
f7db10b
chore: replace logger in sms-auth
Keyrxng Sep 13, 2024
7dbf0ac
chore: update-branch
Keyrxng Sep 13, 2024
590a54a
chore: correct workflow payload env
Keyrxng Sep 13, 2024
99ac8cc
chore: leftover db refactoring
Keyrxng Sep 13, 2024
14edbaf
chore: remove manual, capture repo during setup
Keyrxng Sep 13, 2024
0947e07
feat: targetBranch config item
Keyrxng Sep 13, 2024
11862fd
chore: fix setup-env and id comparison
Keyrxng Sep 13, 2024
d9cdd37
chore: some knip fixes
Keyrxng Sep 13, 2024
423a658
chore: comment fix and pass secret to workflow although not used
Keyrxng Sep 14, 2024
4f690b3
chore: refactor config item name
Keyrxng Sep 15, 2024
1a1ba78
chore: /setwebhook chat command
Keyrxng Sep 26, 2024
c865a92
chore: minor changes
Keyrxng Sep 26, 2024
a223888
chore: delete workflow-function references, getDeepValue, app_id & pk…
Keyrxng Sep 26, 2024
29f6d65
chore: readme
Keyrxng Sep 26, 2024
ec54f4c
chore: remove last of refs
Keyrxng Sep 26, 2024
1e3edc3
chore: remove targetBranch
Keyrxng Sep 26, 2024
9a0a5a1
chore: update readme
Keyrxng Sep 26, 2024
1e212f8
chore: comment about no paths in config
Keyrxng Sep 26, 2024
14c006f
chore: remove #root, downgrade deps, remove test
Keyrxng Sep 27, 2024
e5e31e5
chore: remove issues.opened from manifest
Keyrxng Sep 27, 2024
67e6e55
chore: skip devpool and knip fix
Keyrxng Sep 27, 2024
5604ee4
chore: add deploy-delete workflows
Keyrxng Sep 27, 2024
c8b3325
chore: rename kernel-telegram
Keyrxng Sep 27, 2024
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
17 changes: 16 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"useGitignore": true,
"language": "en",
"words": [
"setwebhook",
"Nektos",
"dataurl",
"devpool",
Expand All @@ -20,7 +21,21 @@
"Typeguards",
"sonarjs",
"knip",
"mischeck"
"mischeck",
"Hono",
"hono",
"mtproto",
"grammyjs",
"setcommands",
"grammyjs",
"botid",
"chatid",
"myid",
"baseclass",
"unarchived",
"libsodium",
"binkey",
"binsec"
],
"dictionaries": ["typescript", "node", "software-terms"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
Expand Down
2 changes: 1 addition & 1 deletion .dev.vars.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MY_SECRET="MY_SECRET"
TELEGRAM_BOT_ENV=
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
MY_SECRET="MY_SECRET"
# Only `yarn setup-env` requires these variables to be set
TELEGRAM_BOT_REPOSITORY_FULL_NAME=
GITHUB_PAT_TOKEN=
14 changes: 6 additions & 8 deletions .github/workflows/compute.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "the name of the plugin"
name: "Workflow Functions"

on:
workflow_dispatch:
Expand All @@ -18,12 +18,11 @@ on:

jobs:
compute:
name: "plugin name"
name: "Kernel-Telegram"
runs-on: ubuntu-latest
permissions: write-all
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
TELEGRAM_BOT_ENV: ${{ secrets.TELEGRAM_BOT_ENV }}

steps:
- uses: actions/checkout@v4
Expand All @@ -37,8 +36,7 @@ jobs:
run: yarn

- name: execute directive
run: npx tsx ./src/main.ts
id: plugin-name
run: npx tsx ./src/workflow-entry.ts
id: Kernel-Telegram
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
TELEGRAM_BOT_ENV: ${{ secrets.TELEGRAM_BOT_ENV }}
4 changes: 2 additions & 2 deletions .github/workflows/worker-delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Retrieve and Construct Full Worker Name
id: construct_worker_name
run: |
base_name=$(grep '^name = ' wrangler.toml | sed 's/^name = "\(.*\)"$/\1/')
base_name=$(grep '^name = ' wrangler.toml | head -n 1 | sed 's/^name = "\(.*\)"$/\1/')
full_worker_name="${base_name}-${{ env.branch_name }}"
# Make sure that it doesnt exceed 63 characters or it will break RFC 1035
full_worker_name=$(echo "${full_worker_name}" | cut -c 1-63)
Expand All @@ -41,4 +41,4 @@ jobs:
- name: Output Deletion Result
run: |
echo "### Deployment URL" >> $GITHUB_STEP_SUMMARY
echo 'Deployment `${{ env.full_worker_name }}` has been deleted.' >> $GITHUB_STEP_SUMMARY
echo 'Deployment `${{ env.full_worker_name }}` has been deleted.' >> $GITHUB_STEP_SUMMARY
13 changes: 5 additions & 8 deletions .github/workflows/worker-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,26 @@ jobs:
run: |
branch_name=$(echo '${{ github.event.ref }}' | sed 's#refs/heads/##' | sed 's#[^a-zA-Z0-9]#-#g')
# Extract base name from wrangler.toml
base_name=$(grep '^name = ' wrangler.toml | sed 's/^name = "\(.*\)"$/\1/')
base_name=$(grep '^name = ' wrangler.toml | head -n 1 | sed 's/^name = "\(.*\)"$/\1/')
# Concatenate branch name with base name
new_name="${base_name}-${branch_name}"
# Truncate the new name to 63 characters for RFC 1035
new_name=$(echo "$new_name" | cut -c 1-63)
# Update the wrangler.toml file
sed -i "s/^name = .*/name = \"$new_name\"/" wrangler.toml
sed -i '0,/^name = .*/{s/^name = .*/name = "'"$new_name"'"/}' wrangler.toml
echo "Updated wrangler.toml name to: $new_name"
- name: Deploy with Wrangler
id: wrangler_deploy
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "3.57.0"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
secrets: |
SUPABASE_URL
SUPABASE_KEY
TELEGRAM_BOT_ENV
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
TELEGRAM_BOT_ENV: ${{ secrets.TELEGRAM_BOT_ENV }}

- name: Write Deployment URL to Summary
run: |
echo "### Deployment URL" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.wrangler_deploy.outputs.deployment-url }}" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.wrangler_deploy.outputs.deployment-url }}" >> $GITHUB_STEP_SUMMARY
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,37 @@ cypress/screenshots
script.ts
.wrangler
test-dashboard.md

# prod
dist/

# dev
.yarn/
!.yarn/releases
.vscode/*
!.vscode/launch.json
!.vscode/*.code-snippets
.idea/workspace.xml
.idea/usage.statistics.xml
.idea/shelf

# deps
node_modules/
.wrangler

# env
.env
.env.production
.dev.vars

# logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# misc
.DS_Store
Loading