generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from ubiquity-os-marketplace/development
Merge development into main
- Loading branch information
Showing
29 changed files
with
2,310 additions
and
2,349 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
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: "Update Configuration" | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
update: | ||
name: "Update Configuration in manifest.json" | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
|
||
steps: | ||
- uses: ubiquity-os/action-deploy-plugin@main |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Delete Deployment | ||
|
||
on: | ||
delete: | ||
|
||
jobs: | ||
delete: | ||
runs-on: ubuntu-latest | ||
name: Delete Deployment | ||
steps: | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.10.0" | ||
|
||
- name: Enable corepack | ||
run: corepack enable | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Get Deleted Branch Name | ||
id: get_branch | ||
run: | | ||
branch_name=$(echo '${{ github.event.ref }}' | sed 's#refs/heads/##' | sed 's#[^a-zA-Z0-9]#-#g') | ||
echo "branch_name=$branch_name" >> $GITHUB_ENV | ||
- name: Retrieve and Construct Full Worker Name | ||
id: construct_worker_name | ||
run: | | ||
base_name=$(grep '^name = ' wrangler.toml | 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) | ||
echo "full_worker_name=$full_worker_name" >> $GITHUB_ENV | ||
- name: Delete Deployment with Wrangler | ||
uses: cloudflare/wrangler-action@v3 | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
command: delete --name ${{ env.full_worker_name }} | ||
|
||
- name: Output Deletion Result | ||
run: | | ||
echo "### Deployment URL" >> $GITHUB_STEP_SUMMARY | ||
echo 'Deployment `${{ env.full_worker_name }}` has been deleted.' >> $GITHUB_STEP_SUMMARY |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Deploy Worker | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy-to-cloudflare: | ||
runs-on: ubuntu-latest | ||
name: Automatic Cloudflare Deploy | ||
steps: | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.10.0" | ||
|
||
- name: Enable corepack | ||
run: corepack enable | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Update wrangler.toml Name Field | ||
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/') | ||
# 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 | ||
echo "Updated wrangler.toml name to: $new_name" | ||
- name: Deploy with Wrangler | ||
id: wrangler_deploy | ||
uses: cloudflare/wrangler-action@v3 | ||
with: | ||
wranglerVersion: "3.80.4" | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
secrets: | | ||
SUPABASE_URL | ||
SUPABASE_KEY | ||
${{ secrets.KERNEL_PUBLIC_KEY && secrets.KERNEL_PUBLIC_KEY != '' && 'KERNEL_PUBLIC_KEY' || '' }} | ||
env: | ||
SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | ||
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }} | ||
KERNEL_PUBLIC_KEY: ${{ secrets.KERNEL_PUBLIC_KEY }} | ||
|
||
- name: Write Deployment URL to Summary | ||
run: | | ||
echo "### Deployment URL" >> $GITHUB_STEP_SUMMARY | ||
echo "${{ steps.wrangler_deploy.outputs.deployment-url }}" >> $GITHUB_STEP_SUMMARY |
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,3 +13,4 @@ junit.xml | |
cypress/screenshots | ||
.dev.vars | ||
/tests/http/http-client.private.env.json | ||
.wrangler |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
dist |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "Query user", | ||
"description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", | ||
"ubiquity:listeners": ["issue_comment.created"], | ||
"commands": { | ||
"query": { | ||
"ubiquity:example": "/query @UbiquityOS", | ||
"description": "Returns the user's wallet, access, and multiplier information." | ||
} | ||
}, | ||
"configuration": { | ||
"type": "object", | ||
"properties": { | ||
"allowPublicQuery": { | ||
"default": true, | ||
"type": "boolean" | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"name": "command-query-user", | ||
"version": "1.0.0", | ||
"description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", | ||
"main": "src/worker.ts", | ||
"main": "src/index.ts", | ||
"author": "Ubiquity DAO", | ||
"license": "MIT", | ||
"engines": { | ||
|
@@ -30,11 +30,13 @@ | |
"open-source" | ||
], | ||
"dependencies": { | ||
"@octokit/rest": "20.1.1", | ||
"@octokit/webhooks": "13.2.7", | ||
"@octokit/rest": "^20.1.0", | ||
"@sinclair/typebox": "0.32.30", | ||
"@supabase/supabase-js": "2.43.2", | ||
"commander": "12.1.0" | ||
"@ubiquity-os/ubiquity-os-kernel": "^2.5.2", | ||
"@ubiquity-os/ubiquity-os-logger": "^1.3.2", | ||
"commander": "12.1.0", | ||
"hono": "^4.6.4" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^18.6.1", | ||
|
@@ -67,8 +69,8 @@ | |
"prettier": "^3.2.5", | ||
"supabase": "1.167.4", | ||
"ts-jest": "29.1.2", | ||
"typescript": "^5.3.3", | ||
"wrangler": "3.57.0" | ||
"typescript": "5.6.2", | ||
"wrangler": "^3.80.4" | ||
}, | ||
"lint-staged": { | ||
"*.ts": [ | ||
|
@@ -83,5 +85,6 @@ | |
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" | ||
} |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createClient } from "@supabase/supabase-js"; | ||
import { createPlugin } from "@ubiquity-os/ubiquity-os-kernel"; | ||
import { ExecutionContext } from "hono"; | ||
import manifest from "../manifest.json"; | ||
import { createAdapters } from "./adapters"; | ||
import { run } from "./run"; | ||
import { SupportedEvents } from "./types/context"; | ||
import { Database } from "./types/database"; | ||
import { Env, envSchema } from "./types/env"; | ||
import { PluginSettings, pluginSettingsSchema } from "./types/plugin-input"; | ||
|
||
export default { | ||
async fetch(request: Request, env: Env, executionContext: ExecutionContext) { | ||
return ( | ||
await createPlugin<PluginSettings, Env, SupportedEvents>( | ||
(context) => { | ||
const supabase = createClient<Database>(context.env.SUPABASE_URL, context.env.SUPABASE_KEY); | ||
return run({ ...context, adapters: createAdapters(supabase, context) }); | ||
}, | ||
// @ts-expect-error strings cannot be assigned to events | ||
manifest, | ||
{ kernelPublicKey: env.KERNEL_PUBLIC_KEY, settingsSchema: pluginSettingsSchema, envSchema: envSchema } | ||
) | ||
).fetch(request, env, executionContext); | ||
}, | ||
}; |
Oops, something went wrong.